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-9 of 9 results.

A004754 Numbers n whose binary expansion starts 10.

Original entry on oeis.org

2, 4, 5, 8, 9, 10, 11, 16, 17, 18, 19, 20, 21, 22, 23, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 128, 129, 130, 131
Offset: 1

Views

Author

Keywords

Comments

A000120(a(n)) = A000120(n); A023416(a(n-1)) = A008687(n) for n > 1. - Reinhard Zumkeller, Dec 04 2015

Examples

			10 in binary is 1010, so 10 is in sequence.
		

Crossrefs

Cf. A123001 (binary version), A004755 (11), A004756 (100), A004757 (101), A004758 (110), A004759 (111).
Apart from initial terms, same as A004761.

Programs

  • Haskell
    import Data.List (transpose)
    a004754 n = a004754_list !! (n-1)
    a004754_list = 2 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004754_list
    -- Reinhard Zumkeller, Dec 04 2015
    
  • Mathematica
    w = {1, 0}; Select[Range[2, 131], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* Michael De Vlieger, Aug 08 2016 *)
  • PARI
    a(n)=n+2^floor(log(n)/log(2))
    
  • PARI
    is(n)=n>1 && !binary(n)[2] \\ Charles R Greathouse IV, Sep 23 2012
    
  • Python
    def A004754(n): return n+(1<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + [n==0].
a(n) = n + 2^floor(log_2(n)) = n + A053644(n).
a(2^m+k) = 2^(m+1) + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003

A004755 Binary expansion starts 11.

Original entry on oeis.org

3, 6, 7, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122
Offset: 1

Views

Author

Keywords

Comments

a(n) is the smallest value > a(n-1) (or > 1 for n=1) for which A001511(a(n)) = A001511(n). - Franklin T. Adams-Watters, Oct 23 2006

Examples

			12 in binary is 1100, so 12 is in the sequence.
		

Crossrefs

Equals union of A079946 and A080565.
Cf. A004754 (10), A004756 (100), A004757 (101), A004758 (110), A004759 (111).

Programs

  • Haskell
    import Data.List (transpose)
    a004755 n = a004755_list !! (n-1)
    a004755_list = 3 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004755_list
    -- Reinhard Zumkeller, Dec 04 2015
    
  • Maple
    a:= proc(n) n+2*2^floor(log(n)/log(2)) end: seq(a(n),n=1..60); # Muniru A Asiru, Oct 16 2018
  • Mathematica
    Flatten[Table[FromDigits[#,2]&/@(Join[{1,1},#]&/@Tuples[{0,1},n]),{n,0,5}]] (* Harvey P. Dale, Feb 05 2015 *)
  • PARI
    a(n)=n+2*2^floor(log(n)/log(2))
    
  • PARI
    is(n)=n>2 && binary(n)[2] \\ Charles R Greathouse IV, Sep 23 2012
    
  • Python
    f = open('b004755.txt', 'w')
    lo = 3
    hi = 4
    i = 1
    while i<16384:
        for x in range(lo,hi):
            f.write(str(i)+" "+str(x)+"\n")
            i += 1
        lo <<= 1
        hi <<= 1
    # Kenny Lau, Jul 05 2016
    
  • Python
    def A004755(n): return n+(1<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2*a(n), a(2n+1) = 2*a(n) + 1 + 2*[n==0].
a(n) = n + 2 * 2^floor(log_2(n)) = A004754(n) + A053644(n).
a(n) = 2n + A080079(n). - Benoit Cloitre, Feb 22 2003
G.f.: (1/(1+x)) * (1 + Sum_{k>=0, t=x^2^k} 2^k*(2t+t^2)/(1+t)).
a(n) = n + 2^(floor(log_2(n)) + 1) = n + A062383(n). - Franklin T. Adams-Watters, Oct 23 2006
a(2^m+k) = 2^(m+1) + 2^m + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003

A004758 Binary expansion starts 110.

Original entry on oeis.org

6, 12, 13, 24, 25, 26, 27, 48, 49, 50, 51, 52, 53, 54, 55, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213
Offset: 1

Views

Author

Keywords

Examples

			26 in binary is 11010, so 26 is in sequence.
		

Crossrefs

Cf. A004754 (10), A004755 (11), A004756 (100), A004757 (101), A004759 (111).

Programs

  • Haskell
    import Data.List (transpose)
    a004758 n = a004758_list !! (n-1)
    a004758_list = 6 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004758_list
    -- Reinhard Zumkeller, Dec 03 2015
    
  • Mathematica
    w = {1, 1, 0}; Select[Range[5, 213], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* or *)
    Table[n + 5*2^Floor@ Log2@ n, {n, 53}] (* Michael De Vlieger, Aug 10 2016 *)
  • PARI
    a(n)=n+5*2^floor(log(n)/log(2))
    
  • Python
    def A004758(n): return n+(5<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 5*[n==0].
a(n) = n + 5 * 2^floor(log_2(n)) = A004757(n) + A053644(n).
a(2^m+k) = 6*2^m + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003

A004756 Binary expansion starts 100.

Original entry on oeis.org

4, 8, 9, 16, 17, 18, 19, 32, 33, 34, 35, 36, 37, 38, 39, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
Offset: 1

Views

Author

Keywords

Examples

			18 in binary is 10010, so 18 is in sequence.
		

Crossrefs

Cf. A004754 (10), A004755 (11), A004757 (101), A004758 (110), A004759 (111).

Programs

  • Haskell
    import Data.List (transpose)
    a004756 n = a004756_list !! (n-1)
    a004756_list = 4 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004756_list
    -- Reinhard Zumkeller, Dec 04 2015
    
  • Mathematica
    Select[Range[4, 153], Take[IntegerDigits[#, 2], 3] == {1, 0, 0} &] (* Michael De Vlieger, Aug 07 2016 *)
  • PARI
    a(n)=n+3*2^floor(log(n)/log(2))
    
  • Python
    def A004756(n): return n+(3<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 3*[n==0].
a(n) = n + 3 * 2^floor(log_2(n)) = A004755(n) + A053644(n).
a(2^m+k) = 2^(m+2) + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 07 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003

A004759 Binary expansion starts 111.

Original entry on oeis.org

7, 14, 15, 28, 29, 30, 31, 56, 57, 58, 59, 60, 61, 62, 63, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244
Offset: 1

Views

Author

Keywords

Comments

This is the minimal recursive sequence such that a(1)=7, A007814(a(n))= A007814(n) and A010060(a(n))=A010060(n). - Vladimir Shevelev, Apr 23 2009

Examples

			30 in binary is 11110, so 30 is in sequence.
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a004759 n = a004759_list !! (n-1)
    a004759_list = 7 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004759_list
    -- Reinhard Zumkeller, Dec 03 2015
    
  • Mathematica
    w = {1, 1, 1}; Select[Range[5, 244], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* Michael De Vlieger, Aug 10 2016 *)
    Sort[FromDigits[#,2]&/@(Flatten[Table[Join[{1,1,1},#]&/@Tuples[{1,0},n],{n,0,5}],1])] (* Harvey P. Dale, Sep 01 2016 *)
  • PARI
    a(n)=n+6*2^floor(log(n)/log(2))
    
  • Python
    def A004759(n): return n+(3<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 6[n==0].
a(n) = n + 6 * 2^floor(log_2(n)) = A004758(n) + A053644(n).
a(n+1) = min{m > a(n): A007814(m) = A007814(n+1) and A010060(m) = A010060(n+1)}. a(2^k) - a(2^k-1) = A103204(k+2), k >= 1. - Vladimir Shevelev, Apr 23 2009
a(2^m+k) = 7*2^m + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003

A343852 a(n) is the least k > 0 such that the binary expansions of k and of n + k have the same numbers of 0's and of 1's.

Original entry on oeis.org

5, 10, 9, 20, 21, 18, 17, 40, 19, 42, 38, 36, 37, 34, 33, 80, 35, 38, 37, 84, 35, 76, 74, 72, 73, 74, 70, 68, 69, 66, 65, 160, 67, 70, 69, 76, 67, 74, 73, 168, 75, 70, 69, 152, 67, 148, 146, 144, 71, 146, 145, 148, 140, 140, 138, 136, 137, 138, 134, 132, 133
Offset: 1

Views

Author

Rémy Sigrist, May 03 2021

Keywords

Comments

This is the binary analog of A343888.
The required comparisons are (1) that the number of ones in the binary expansion of k must equal the number of ones in the binary expansion of k+n, and (2) that the number of zeroes in the binary expansion of k must equal the number of zeroes in the binary expansion of k+n. See the example below. - Harvey P. Dale, Dec 19 2024

Examples

			The first terms, alongside the binary expansions of a(n) and of n + a(n), are:
  n   a(n)  bin(a(n))  bin(n+a(n))
  --  ----  ---------  -----------
   1     5        101          110
   2    10       1010         1100
   3     9       1001         1100
   4    20      10100        11000
   5    21      10101        11010
   6    18      10010        11000
   7    17      10001        11000
   8    40     101000       110000
   9    19      10011        11100
  10    42     101010       110100
  11    38     100110       110001
  12    36     100100       110000
  13    37     100101       110010
  14    34     100010       110000
  15    33     100001       110000
		

Crossrefs

Programs

  • Mathematica
    lk[n_]:=Module[{k=1},While[DigitCount[k,2,0]!=DigitCount[n+k,2,0]||DigitCount[k,2,1]!=DigitCount[n+k,2,1],k++];k]; Array[lk,70] (* Harvey P. Dale, Dec 19 2024 *)
  • PARI
    a(n) = { for (k=1, oo, if (#binary(k)==#binary(n+k) && hammingweight(k)==hammingweight(n+k), return (k))) }
    
  • Python
    def a(n):
      k = 1
      while k.bit_length() != (n+k).bit_length() or bin(k).count('1') != bin(n+k).count('1'): k += 1
      return k
    print([a(n) for n in range(1, 62)]) # Michael S. Branicky, May 04 2021

Formula

a(n) <= A004757(n).

A345254 Dispersion of A004754, a rectangular array T(n,k) read by downward antidiagonals.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 9, 10, 7, 16, 17, 18, 11, 12, 32, 33, 34, 19, 20, 13, 64, 65, 66, 35, 36, 21, 14, 128, 129, 130, 67, 68, 37, 22, 15, 256, 257, 258, 131, 132, 69, 38, 23, 24, 512, 513, 514, 259, 260, 133, 70, 39, 40, 25, 1024, 1025, 1026, 515, 516, 261, 134
Offset: 1

Views

Author

J. Parker Shectman, Jun 12 2021

Keywords

Comments

As a sequence, {a(n)} permutes the positive integers. As an array, {T(n,k)} is an interspersion-dispersion or I-D array (refer to Kimberling, 1st linked reference).
The top row of {T(n,k)} is A000079 or powers of two = 1, 2, 4, 8, 16, ....
Except for the leftmost element "1" of the top row, rows of T(n,k) indexed n = 0, 1, 2, ..., consist entirely of even numbers (A005843) for n even and entirely of odd numbers (A005408) for n odd.
The left column (k = 1) of {T(n,k)} comprises a "1" for the top row (n = 0) and A004755(n) = n + 2^(floor(log_2(n)) + 1), for rows n = 1, 2, 3, ....
For rows indexed n = 0, 1, 2, ..., and columns indexed k = 1, 2, 3, ..., T(n,k) is given by T(0,k) = L^(k - 1)(1) and T(n,k) = L^(k - 1) R(n) for n = 1, 2, 3, ..., the image of n under a composition of branching functions L(n) = A004754(n) = n + 2^floor(log_2(n)) and R(n) = A004755(n) = n + 2^(floor(log_2(n)) + 1) (cf. generating tree A059893 and 2nd linked reference).
(Duality with array A054582): Consider A059893 and A000027 as labeled binary trees arranging the positive integers. In latter tree, node labels equal node positions, thus following their natural order. Rows of {T(n,k)} are the labels along maximal straight paths that always branch left in the former tree, while rows of (transposed) array A054582 are the labels along maximal straight paths that always branch left in the latter tree.
Column k of {T(n,k)} comprises the (sorted) labels in the k-th right clade of latter tree, while column k of (transposed) A054582 comprises the (sorted) labels in the k-th right clade of the former tree. This makes the arrays {T(n,k)} and (transposed) A054582 "blade-duals," blade being a contraction of branch-clade ('right clades' explained under tree A345253 and in 2nd link).
Write the positive integers in natural order as a (left-justified) "tetrangle" or "irregular triangle" tableau with 2^t entries on each row t, for t=1, 2, 3, .... Then, columns of the tableau equal rows of {T(n,k)} (2nd link):
1,
2, 3,
4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
...
Analogous to A345252, its right-justified tableau of the positive integers in cohorts with lengths the Fibonacci numbers replaced by the above left-justified tableau with powers of two as lengths of the cohorts.
(Mirror duality): A "mirror dual" I-D array or "inverse I-D array" (see Kimberling, 1st linked reference) is obtained by substituting the left-justified tableau by a right-justified tableau and following the identical procedure, or equivalently by mirroring the tree A059893 cited above, i.e., taking maximal straight paths that always branch right in the tree A059893. With two types of duality then, {T(n,k)} forms a quartet of I-D arrays together with its mirror dual, its blade dual (transposed) A054582 and mirror dual A191448 of the latter.
(Para-sequences): Sequences of row and column indices (see Conway-Sloane correspondence under A019586, citing Kimberling). For rows indexed n = 0, 1, 2, ..., and columns indexed k = 1, 2, 3, ..., the row index n of positive integer T(n,k) is A053645(T) and the column index k of positive integer T(n,k) is A065120(T).

Examples

			Northwest corner of {T(n,k)}:
       k=1   k=2    k=3     k=4      k=5       k=6
  n=0:   1,    2,     4,      8,      16,       32, ...
  n=1:   3,    5,     9,     17,      33,       65, ...
  n=2:   6,   10,    18,     34,      66,      130, ...
  n=3:   7,   11,    19,     35,      67,      131, ...
  n=4:  12,   20,    36,     68,     132,      260, ...
  ...
Northwest corner of {T(n,k)} in base-2:
        k=1  k=2    k=3     k=4      k=5       k=6
  n=0:  1,   10,    100,    1000,    10000,    100000, ...
  n=1:  11,  101,   1001,   10001,   100001,   1000001, ...
  n=2:  110, 1010,  10010,  100010,  1000010,  10000010, ...
  n=3:  111, 1011,  10011,  100010,  1000011,  10000011, ...
  n=4:  1100,10100, 100100, 1000100, 10000100, 100000100, ...
  ...
		

Crossrefs

Programs

  • Mathematica
    (*Simplified Formula*)
    MatrixForm[Prepend[Table[n + 2^(Floor[Log[2, n]] + k), {n, 1, 4}, {k, 1, 6}], Table[2^(k - 1), {k, 1, 6}]]]
    (*Branching Formula*)
    MatrixForm[Prepend[Table[NestList[Function[# + 2^(Floor[Log[2, #]])], n + 2^(Floor[Log[2, n]] + 1), 5], {n, 1, 4}], NestList[Function[# + 2^(Floor[Log[2, #]])], 1, 5]]]
  • PARI
    T(n, k) = if (n==0, 2^(k-1), n + 2^(log(n)\log(2) + k));
    matrix(7, 7, n, k, n--; T(n, k)) \\ Michel Marcus, Jul 30 2021

Formula

T(0,k) = 2^(k - 1) and T(n,k) = n + 2^(floor(log_2(n)) + k) for n >= 1.
T(0,k) = L^(k - 1)(1) and T(n,k) = L^(k - 1) R(n) for n = 1, 2, 3, ..., where L(n) = A004754(n) = n + 2^floor(log_2(n)) and R(n) = A004755(n) = n + 2^(floor(log_2(n)) + 1).
Let b(n) = A054582(n-1). Then for all n >= 1, a(n) = A139706(b(n)) and b(n) = A139708(a(n)).

A122872 Table by antidiagonals, T(n,k) is k-th number that starts with n in binary representation.

Original entry on oeis.org

1, 2, 2, 3, 4, 3, 4, 5, 6, 4, 5, 8, 7, 8, 5, 6, 9, 12, 9, 10, 6, 7, 10, 13, 16, 11, 12, 7, 8, 11, 14, 17, 20, 13, 14, 8, 9, 16, 15, 18, 21, 24, 15, 16, 9, 10, 17, 24, 19, 22, 25, 28, 17, 18, 10, 11, 18, 25, 32, 23, 26, 29, 32, 19, 20, 11, 12, 19, 26, 33, 40, 27, 30, 33, 36, 21, 22, 12
Offset: 1

Views

Author

Keywords

Comments

In rows n through 2n-1, every integer >= n occurs exactly once.

Examples

			Top left corner is:
1 2 3 4 5
2 4 5 8 9
3 6 7 12 13
4 8 9 16 17
5 10 11 20 21
		

Crossrefs

Rows: A000027, A004754, A004755, A004756, A004757, A004758, A004759. Algebraically, A053645 would be row zero, minus A080079 would be row minus one. See also A053644.

Formula

T(n,1) = n; T(n,2k) = 2T(n,k); T(n,2k+1) = 2T(n,k) + 1. T(n,k) = k + (n-1) * 2^floor(log_2(k)) = k + (n-1)*A053644(k).

A322261 Square array T(n, k) (n >= 0, k >= 0) read by antidiagonals upwards: the lengths of runs in binary expansion of T(n, k) correspond to the lengths of runs in binary expansion of n followed by the lengths of runs in binary expansion of k.

Original entry on oeis.org

0, 1, 1, 2, 2, 2, 3, 5, 5, 3, 4, 6, 10, 4, 4, 5, 9, 13, 11, 11, 5, 6, 10, 18, 12, 20, 10, 6, 7, 13, 21, 19, 27, 21, 9, 7, 8, 14, 26, 20, 36, 26, 22, 8, 8, 9, 17, 29, 27, 43, 37, 25, 23, 23, 9, 10, 18, 34, 28, 52, 42, 38, 24, 40, 22, 10, 11, 21, 37, 35, 59, 53
Offset: 0

Views

Author

Rémy Sigrist, Dec 01 2018

Keywords

Comments

The array T is associative.

Examples

			Array T(n, k) begins (in decimal):
  n\k|  0   1   2   3   4   5   6   7    8    9   10   11   12
  ---+--------------------------------------------------------
    0|  0   1   2   3   4   5   6   7    8    9   10   11   12
    1|  1   2   5   4  11  10   9   8   23   22   21   20   19
    2|  2   5  10  11  20  21  22  23   40   41   42   43   44
    3|  3   6  13  12  27  26  25  24   55   54   53   52   51
    4|  4   9  18  19  36  37  38  39   72   73   74   75   76
    5|  5  10  21  20  43  42  41  40   87   86   85   84   83
    6|  6  13  26  27  52  53  54  55  104  105  106  107  108
    7|  7  14  29  28  59  58  57  56  119  118  117  116  115
    8|  8  17  34  35  68  69  70  71  136  137  138  139  140
Array T(n, k) begins (in binary):
  n\k |     0      1      10      11      100      101      110      111      1000
  ----+---------------------------------------------------------------------------
     0|     0      1      10      11      100      101      110      111      1000
     1|     1     10     101     100     1011     1010     1001     1000     10111
    10|    10    101    1010    1011    10100    10101    10110    10111    101000
    11|    11    110    1101    1100    11011    11010    11001    11000    110111
   100|   100   1001   10010   10011   100100   100101   100110   100111   1001000
   101|   101   1010   10101   10100   101011   101010   101001   101000   1010111
   110|   110   1101   11010   11011   110100   110101   110110   110111   1101000
   111|   111   1110   11101   11100   111011   111010   111001   111000   1110111
  1000|  1000  10001  100010  100011  1000100  1000101  1000110  1000111  10001000
		

Crossrefs

Programs

  • PARI
    torl(n) = my (r=[]); while (n, r = concat(valuation(n+(n%2),2), r); n \= 2^r[1];); r
    fromrl(r) = my (v=0); for (i=1, #r, v = (v + (i%2))*2^r[i]-(i%2)); v
    T(n,k) = fromrl(concat(torl(n), torl(k)))

Formula

T(n, 0) = T(0, n) = n.
T(n, 1) = A042963(n+1).
T(n, 2) = A047617(n+1).
T(n, 3) = A047457(n+1).
T(1, n) = A010078(n+1).
T(2, n) = A004757(n) for any n > 0.
A005811(T(n, k)) = A005811(n) + A005811(k).
T(2*n, k) = A163621(2*n, k) for any n > 0 and k > 0.
T(2*n, 2*n) = A020330(2*n) for any n > 0.
Showing 1-9 of 9 results.