cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 10 results.

A007088 The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.

Original entry on oeis.org

0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, 10010, 10011, 10100, 10101, 10110, 10111, 11000, 11001, 11010, 11011, 11100, 11101, 11110, 11111, 100000, 100001, 100010, 100011, 100100, 100101, 100110, 100111
Offset: 0

Views

Author

Keywords

Comments

List of binary numbers. (This comment is to assist people searching for that particular phrase. - N. J. A. Sloane, Apr 08 2016)
Or, numbers that are sums of distinct powers of 10.
Or, numbers having only digits 0 and 1 in their decimal representation.
Complement of A136399; A064770(a(n)) = a(n). - Reinhard Zumkeller, Dec 30 2007
From Rick L. Shepherd, Jun 25 2009: (Start)
Nonnegative integers with no decimal digit > 1.
Thus nonnegative integers n in base 10 such that kn can be calculated by normal addition (i.e., n + n + ... + n, with k n's (but not necessarily k + k + ... + k, with n k's)) or multiplication without requiring any carry operations for 0 <= k <= 9. (End)
For n > 1: A257773(a(n)) = 10, numbers that are Belgian-k for k=0..9. - Reinhard Zumkeller, May 08 2015
For any integer n>=0, find the binary representation and then interpret as decimal representation giving a(n). - Michael Somos, Nov 15 2015
N is in this sequence iff A007953(N) = A101337(N). A028897 is a left inverse. - M. F. Hasler, Nov 18 2019
For n > 0, numbers whose largest decimal digit is 1. - Stefano Spezia, Nov 15 2023

Examples

			a(6)=110 because (1/2)*((1-(-1)^6)*10^0 + (1-(-1)^3)*10^1 + (1-(-1)^1)*10^2) = 10 + 100.
G.f. = x + 10*x^2 + 11*x^3 + 100*x^4 + 101*x^5 + 110*x^6 + 111*x^7 + 1000*x^8 + ...
.
  000    The numbers < 2^n can be regarded as vectors with
  001    a fixed length n if padded with zeros on the left
  010    side. This represents the n-fold Cartesian product
  011    over the set {0, 1}. In the example on the left,
  100    n = 3. (See also the second Python program.)
  101    Binary vectors in this format can also be seen as a
  110    representation of the subsets of a set with n elements.
  111    - _Peter Luschny_, Jan 22 2024
		

References

  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 21.
  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §2.8 Binary, Octal, Hexadecimal, p. 64.
  • Manfred R. Schroeder, "Fractals, Chaos, Power Laws", W. H. Freeman, 1991, p. 383.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

The basic sequences concerning the binary expansion of n are this one, A000120 (Hammingweight: sum of bits), A000788 (partial sums of A000120), A000069 (A000120 is odd), A001969 (A000120 is even), A023416 (number of bits 0), A059015 (partial sums). Bisections A099820 and A099821.
Cf. A028897 (convert binary to decimal).

Programs

  • Haskell
    a007088 0 = 0
    a007088 n = 10 * a007088 n' + m where (n',m) = divMod n 2
    -- Reinhard Zumkeller, Jan 10 2012
    
  • Maple
    A007088 := n-> convert(n, binary): seq(A007088(n), n=0..50); # R. J. Mathar, Aug 11 2009
  • Mathematica
    Table[ FromDigits[ IntegerDigits[n, 2]], {n, 0, 39}]
    Table[Sum[ (Floor[( Mod[f/2 ^n, 2])])*(10^n) , {n, 0, Floor[Log[2, f]]}], {f, 1, 100}] (* José de Jesús Camacho Medina, Jul 24 2014 *)
    FromDigits/@Tuples[{1,0},6]//Sort (* Harvey P. Dale, Aug 10 2017 *)
  • PARI
    {a(n) = subst( Pol( binary(n)), x, 10)}; /* Michael Somos, Jun 07 2002 */
    
  • PARI
    {a(n) = if( n<=0, 0, n%2 + 10*a(n\2))}; /* Michael Somos, Jun 07 2002 */
    
  • PARI
    a(n)=fromdigits(binary(n),10) \\ Charles R Greathouse IV, Apr 08 2015
    
  • Python
    def a(n): return int(bin(n)[2:])
    print([a(n) for n in range(40)]) # Michael S. Branicky, Jan 10 2021
    
  • Python
    from itertools import product
    n = 4
    for p in product([0, 1], repeat=n): print(''.join(str(x) for x in p))
    # Peter Luschny, Jan 22 2024

Formula

a(n) = Sum_{i=0..m} d(i)*10^i, where Sum_{i=0..m} d(i)*2^i is the base 2 representation of n.
a(n) = (1/2)*Sum_{i>=0} (1-(-1)^floor(n/2^i))*10^i. - Benoit Cloitre, Nov 20 2001
a(n) = A097256(n)/9.
a(2n) = 10*a(n), a(2n+1) = a(2n)+1.
G.f.: 1/(1-x) * Sum_{k>=0} 10^k * x^(2^k)/(1+x^(2^k)) - for sequence as decimal integers. - Franklin T. Adams-Watters, Jun 16 2006
a(A000290(n)) = A001737(n). - Reinhard Zumkeller, Apr 25 2009
a(n) = Sum_{k>=0} A030308(n,k)*10^k. - Philippe Deléham, Oct 19 2011
For n > 0: A054055(a(n)) = 1. - Reinhard Zumkeller, Apr 25 2012
a(n) = Sum_{k=0..floor(log_2(n))} floor((Mod(n/2^k, 2)))*(10^k). - José de Jesús Camacho Medina, Jul 24 2014

A094694 Numbers having in binary representation more 1s than their squares.

Original entry on oeis.org

23, 46, 47, 92, 94, 95, 111, 184, 188, 190, 191, 222, 223, 367, 368, 376, 380, 382, 383, 415, 444, 446, 447, 479, 727, 734, 736, 752, 760, 764, 766, 767, 830, 831, 887, 888, 892, 894, 895, 958, 959, 1451, 1454, 1468, 1471, 1472, 1503, 1504, 1520, 1528
Offset: 1

Views

Author

Reinhard Zumkeller, May 20 2004

Keywords

Comments

A000120(a(n)) > A000120(A000290(a(n))).

Crossrefs

Programs

  • Mathematica
    Select[Range[1600], DigitCount[#, 2, 1] > DigitCount[#^2, 2, 1] &] (* Harvey P. Dale, Mar 24 2012 *)
  • PARI
    is(n)=hammingweight(n)>hammingweight(n^2) \\ Charles R Greathouse IV, Jan 27 2014
    
  • Python
    print([k for k in range(0, 1530) if bin(k)[2:].count("1") > bin(k**2)[2:].count("1")]) # Karl-Heinz Hofmann, Feb 07 2022

A221643 Numbers k such that k^2 XOR (k+1)^2 is a square, where XOR is the bitwise XOR operator.

Original entry on oeis.org

0, 3, 4, 23, 24, 43, 44, 76, 111, 112, 115, 139, 164, 180, 183, 248, 264, 323, 327, 348, 411, 479, 480, 499, 611, 699, 747, 787, 943, 976, 1072, 1103, 1111, 1176, 1268, 1388, 1447, 1576, 1684, 1851, 1983, 1984, 2008, 2243, 2692, 3271, 3383, 3452, 3464, 3532, 3679, 3804, 3867
Offset: 1

Views

Author

Alex Ratushnyak, Mar 27 2013

Keywords

Crossrefs

Programs

  • Python
    import math
    for i in range(1<<16):
        s = (i*i) ^ ((i+1)*(i+1))
        t = int(math.sqrt(s))
        if s == t*t:
            print(str(i), end=',')

A063009 Write n in binary then square as if written in base 10.

Original entry on oeis.org

0, 1, 100, 121, 10000, 10201, 12100, 12321, 1000000, 1002001, 1020100, 1022121, 1210000, 1212201, 1232100, 1234321, 100000000, 100020001, 100200100, 100220121, 102010000, 102030201, 102212100, 102232321, 121000000, 121022001
Offset: 0

Views

Author

Henry Bottomley, Jul 04 2001

Keywords

Comments

The original description was: "Pre-carry binary squares: write n in binary then square as if written in a base large enough to avoid carries". But I changed it, since I prefer to work in base 10. There is no difference until a(1023). - N. J. A. Sloane, May 21 2002

Examples

			a(11)=1022121 since 11 written in binary is 1011 and 1011^2 = 1011000 + 0 + 10110 + 1011 = 1022121.
a(1023) = 1111111111^2 = 1234567900987654321.
		

Crossrefs

Cf. A007088 for binary numbers, A001737 for binary squares (post-carry), A063010 for carryless binary squares.

Programs

Formula

a(2n) = 100*a(n); a(2n+1) = 100*a(n) + 20*A007088(n) + 1.

A165820 a(n) = the smallest positive integer that, when written in binary, contains both binary n and binary n^2 as substrings.

Original entry on oeis.org

1, 4, 19, 16, 89, 100, 113, 64, 593, 1380, 377, 400, 425, 452, 481, 256, 4385, 1298, 723, 10640, 5561, 11748, 8471, 18456, 1649, 1700, 729, 1808, 1865, 1924, 1985, 1024, 33857, 9250, 36041, 75024, 5477, 11558, 40433, 83520, 1681, 87780, 22329, 92048
Offset: 1

Views

Author

Leroy Quet, Sep 28 2009

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = 1, is = IntegerString[n, 2], iss = IntegerString[n^2, 2]}, While[ StringPosition[ IntegerString[k, 2], is] == {} || StringPosition[ IntegerString[k, 2], iss] == {}, k++ ]; k]; Array[f, 44] (* Robert G. Wilson v, Oct 02 2009 *)

Formula

a(n) = A294977(n, n^2). - Rémy Sigrist, Mar 03 2018

Extensions

a(7)-a(44) from Robert G. Wilson v, Oct 02 2009

A091092 In binary representation: minimal number of editing steps (delete, insert or substitute) to transform n into n^2.

Original entry on oeis.org

0, 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 6, 6, 6, 7, 7, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 7, 7, 6, 6, 6, 6, 6, 7, 7, 7, 7, 6, 7, 8, 8, 7, 8, 8, 7, 7, 7, 7, 7, 8
Offset: 0

Views

Author

Reinhard Zumkeller, Dec 18 2003

Keywords

Comments

a(n) = A152487(A000290(n),n). - Reinhard Zumkeller, Dec 06 2008

Examples

			a(7)=3: 7->'111', 3 x insert a 0 between the last two 1's:
'110001'->49=7^2.
		

Crossrefs

Formula

a(n) = LevenshteinDistance(A007088(n), A001737(n)).

A091091 Numbers needing in binary and ternary representation an equal minimal number of editing steps (delete, insert or substitute) to transform them into their square.

Original entry on oeis.org

0, 1, 5, 6, 8, 11, 13, 16, 17, 18, 19, 33, 35, 38, 40, 56, 60, 74, 122, 123, 133, 143, 146, 164, 168, 173, 299, 350, 365, 429, 497, 515, 527, 564, 566, 593, 608, 611, 710, 1031, 1050, 1052, 1059, 1088, 1089, 1090, 1092, 1096, 1105, 1287, 1301, 1316, 1322
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 18 2003

Keywords

Comments

A091092(a(n)) = A091093(a(n)).

Crossrefs

A094695 Numbers having in binary representation fewer ones than in their squares.

Original entry on oeis.org

5, 9, 10, 11, 13, 17, 18, 19, 20, 21, 22, 25, 26, 27, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 93, 97, 98, 99
Offset: 1

Views

Author

Reinhard Zumkeller, May 20 2004

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[100],DigitCount[#,2,1]Harvey P. Dale, May 29 2017 *)

Formula

A000120(a(n)) < A000120(A000290(a(n))).

A358701 a(n) is the least number > 1 that needs n toggles in the trailing bits of its binary representation to become a square.

Original entry on oeis.org

4, 5, 7, 14, 79, 831, 6495, 247614, 7361278, 743300286, 121387475838
Offset: 0

Views

Author

Hugo Pfoertner, Dec 16 2022

Keywords

Examples

			a(0) = 4 = 100 in binary, 0 toggled bits needed;
a(1) = 5 = 101_2, 1 toggled bit -> 100_2 = 4;
a(2) = 7 = 111_2, 2 toggled bits -> 100_2 = 4;
a(3) = 14 = 1110_2, 3 toggled bits -> 1001_2 = 9;
a(4) = 79 = 1001111_2, 4 toggled bits -> 1000000_2 = 64;
a(5) = 831 = 1100111111_2, 5 toggled bits -> 1100010000_2 = 784 = 28^2.
		

Crossrefs

Programs

  • Go
    // see linked program
    (C#) // see linked program

Extensions

a(9) from Michael S. Branicky, Dec 19 2022
a(10) from Delbert L. Johnson, Apr 13 2024

A098800 Length of longest prefix of binary representation of n that is also a suffix of that of n^2.

Original entry on oeis.org

1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3, 4, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3, 1, 0, 4, 3, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3, 1, 0, 1, 3, 5, 0, 1, 3, 4, 0, 4, 3, 1, 0, 1, 0, 6, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 5, 0, 1, 0
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 31 2004

Keywords

Crossrefs

Showing 1-10 of 10 results.