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 24 results. Next

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

A080079 Least number causing the longest carry sequence when adding numbers <= n to n in binary representation.

Original entry on oeis.org

1, 2, 1, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 26 2003

Keywords

Comments

T(n,k) < T(n,a(n)) = A070940(n) for 1 <= k < a(n) and T(n,k) <= T(n,a(n)) for a(n) <= k <= n, where T is defined as in A080080.
a(n) gives the distance from n to the nearest 2^t > n. - Ctibor O. Zizka, Apr 09 2020

Crossrefs

Programs

  • Haskell
    a080079 n = (length $ takeWhile (< a070940 n) (a080080_row n)) + 1
    -- Reinhard Zumkeller, Apr 22 2013
    
  • Magma
    [-n+2*2^Floor(Log(n)/Log(2)): n in [1..80]]; // Vincenzo Librandi, Dec 01 2016
    
  • Maple
    # Alois P. Heinz observes in A327489:
    A080079 := n -> 1 + Bits:-Nor(n, n):
    # Likewise:
    A080079 := n -> 1 + Bits:-Nand(n, n):
    seq(A080079(n), n=1..81); # Peter Luschny, Sep 23 2019
  • Mathematica
    Flatten@Table[Nest[Most[RotateRight[#]] &, Range[n], n - 1], {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)
    Table[FromDigits[(IntegerDigits[n, 2] /. {0 -> 1, 1 -> 0}), 2] +
    1, {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)
    Table[BitXor[n, 2^IntegerPart[Log[2, n] + 1] - 1] + 1, {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)
    Table[2 2^Floor[Log[2, n]] - n, {n, 30}] (* Birkas Gyorgy, Feb 07 2011 *)
    Flatten@Table[Reverse@Range[2^n], {n, 0, 4}] (* Birkas Gyorgy, Feb 07 2011 *)
  • Python
    def A080079(n): return (1 << n.bit_length())-n # Chai Wah Wu, Jun 30 2022

Formula

From Benoit Cloitre, Feb 22 2003: (Start)
a(n) = A004755(n) - 2*n.
a(n) = -n + 2*2^floor(log(n)/log(2)). (End)
From Ralf Stephan, Jun 02 2003: (Start)
a(n) = n iff n = 2^k, otherwise a(n) = A035327(n-1).
a(n) = A062383(n) - n. (End)
a(0) = 0, a(2*n) = 2*a(n), a(2*n+1) = 2*a(n)-1 + 2*[n==0]. - Ralf Stephan, Jan 04 2004
a(n) = A240769(n,1); A240769(n, a(n)) = 1. - Reinhard Zumkeller, Apr 13 2014
a(n) = n + 1 - A006257(n). - Reinhard Zumkeller, Apr 14 2014

A004780 Binary expansion contains 2 adjacent 1's.

Original entry on oeis.org

3, 6, 7, 11, 12, 13, 14, 15, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 35, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 67, 70, 71, 75, 76, 77, 78, 79, 83, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
Offset: 1

Views

Author

Keywords

Comments

Complement of A003714. It appears that n is in the sequence if and only if C(3n,n) is even. - Benoit Cloitre, Mar 09 2003
Since the binary representation of these numbers contains two adjacent 1's, so for these values of n, we will have (n XOR 2n XOR 3n) != 0, and thus a two player Nim game with three heaps of (n, 2n, 3n) stones will be a winning configuration for the first player. - V. Raman, Sep 17 2012
A048728(a(n)) > 0. - Reinhard Zumkeller, May 13 2014
The set of numbers x such that Or(x,3*x) <> 3*x. - Gary Detlefs, Jun 04 2024

Crossrefs

Complement: A003714.
Subsequences (apart from any initial zero-term): A001196, A004755, A004767, A033428, A277335.

Programs

  • Haskell
    a004780 n = a004780_list !! (n-1)
    a004780_list = filter ((> 1) . a048728) [1..]
    -- Reinhard Zumkeller, May 13 2014
    
  • Maple
    q:= n-> verify([1$2], Bits[Split](n), 'sublist'):
    select(q, [$0..200])[];  # Alois P. Heinz, Oct 22 2021
  • PARI
    is(n)=bitand(n,n+n)>0 \\ Charles R Greathouse IV, Sep 19 2012
    
  • Python
    from itertools import count, islice
    def A004780_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:n&(n<<1), count(max(startvalue,1)))
    A004780_list = list(islice(A004780_gen(),30)) # Chai Wah Wu, Jul 13 2022

Formula

a(n) ~ n. - Charles R Greathouse IV, Sep 19 2012

Extensions

Offset corrected by Reinhard Zumkeller, Jul 28 2010

A079946 Numbers k whose binary expansion begins with two or more 1's and ends with at least one 0.

Original entry on oeis.org

6, 12, 14, 24, 26, 28, 30, 48, 50, 52, 54, 56, 58, 60, 62, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246
Offset: 1

Views

Author

N. J. A. Sloane, Feb 21 2003

Keywords

Comments

a(n) = b(n+1), with b(2n) = 2b(n), b(2n+1) = 2b(n)+2+4[n==0]. - Ralf Stephan, Oct 11 2003

Crossrefs

A004755 = union of this and A080565. A057547(n) = a(A014486(n)) for n >= 1.

Programs

  • Maple
    A079946 := n -> 2*(2^(1+A000523(n))+n);
  • Mathematica
    Table[Union[FromDigits[Join[{1,1},#,{0}],2]&/@Tuples[{1,0},n]],{n,0,5}]//Flatten (* Harvey P. Dale, Jan 16 2018 *)
  • PARI
    for(n=0,6, for(k=2^(n-1),2^n-1,print1((2^n+k)*2,",")))
    
  • PARI
    for(n=1,59,print1((2^(floor(log(n)/log(2))+1)+n)*2,","))
    
  • PARI
    a(n) = n*2 + 4<Ruud H.G. van Tol, May 10 2024
    
  • Python
    def A079946(n): return n+(1<Chai Wah Wu, Jul 13 2022

Formula

a(n) = 2^floor(log_2(4*n))+2*n. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 22 2003
a(n) = (2^(floor(log_2(n))+1)+n)*2. - Klaus Brockhaus, Feb 23 2003
a(2n) = 2a(n), a(2n+1) = 2a(n) + 2 + 4[n==0]. Twice A004755. - Ralf Stephan, Oct 12 2003

Extensions

Definition clarified by N. J. A. Sloane, May 10 2024

A218616 The infinite trunk of beanstalk (A179016) with reversed subsections.

Original entry on oeis.org

0, 1, 3, 7, 4, 15, 11, 8, 31, 26, 23, 19, 16, 63, 57, 53, 49, 46, 42, 39, 35, 32, 127, 120, 116, 112, 109, 104, 101, 97, 94, 89, 85, 81, 78, 74, 71, 67, 64, 255, 247, 240, 236, 231, 225, 221, 215, 209, 205, 200, 197, 193, 190, 184, 180, 176, 173, 168, 165, 161
Offset: 0

Views

Author

Antti Karttunen, Nov 10 2012

Keywords

Comments

This can be viewed as an irregular table: after the initial zero on row 0, start each row n with (2^n)-1 and subtract repeatedly the number of 1-bits to get successive terms, until the number that has already been listed (which is always (2^(n-1))-1) is encountered, which is not listed second time, but instead, the current row is finished and the next row starts with (2^(n+1))-1, with the same process repeated.
This contains the terms in the infinite trunk of beanstalk (A179016) listed in partially reversed manner: after the initial zero each subsequence lists A213709(n) successive terms from A179016, descending from (2^n)-1 downwards, usually down to 2^(n-1) (conjectured to indeed be a power of 2 in each case, apart from 2 itself missing from the beginning of the sequence).
Currently A179016 and many of the derived sequences are much easier and somewhat faster to compute with the help of this sequence, especially if the program computes any other required values incrementally in the same loop.

Examples

			After zero, we start with (2^1)-1 = 1, subtract A000120(1)=1 from it, resulting 1-1=0 (which is of the form (2^0)-1, thus not listed second time), instead, start the next row with (2^2)-1 = 3, subtract A000120(3)=2 from it, resulting 3-2=1, which has been already encountered, thus start the next row with (2^3)-1 = 7, subtract A000120(7)=3 from it, resulting 7-3=4, which is listed after 7, then 4-A000120(4)=4-1=3, which is of the form (2^k)-1 and already encountered, thus start the next row with (2^4)-1 = 15, etc. This results an irregular table which begins as:
0; 1; 3; 7, 4; 15, 11, 8; 31, 26, 23, 19, 16; 63, 57, ...
After zero, each row n is A213709(n-1) elements long.
		

Crossrefs

a(n) = A179016(A218602(n)). The rows are the initial portions of every (2^n)-1:th row in A218254.

Formula

a(0)=0, a(1)=1, and for n > 1, if n = A213710(A213711(n)-1) then a(n) = (2^A213711(n)) - 1, and in other cases, a(n) = A011371(a(n-1)).
Alternatively: For n < 4, a(n) = (2^n)-1, and for n >= 4, a(n) = A004755(A004755(A011371(a(n-1)))) if A011371(a(n-1))+1 is power of 2, otherwise just A011371(a(n-1)).

A257250 Numbers n for which A256999(n) = n; numbers that cannot be made any larger by rotating (by one or more steps) the non-msb bits of their binary representation (with A080541 or A080542).

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 8, 12, 14, 15, 16, 24, 26, 28, 30, 31, 32, 48, 52, 56, 58, 60, 62, 63, 64, 96, 100, 104, 106, 112, 114, 116, 118, 120, 122, 124, 126, 127, 128, 192, 200, 208, 212, 224, 226, 228, 232, 234, 236, 240, 242, 244, 246, 248, 250, 252, 254, 255, 256, 384, 392, 400, 416, 420, 424, 426, 448, 450
Offset: 0

Views

Author

Antti Karttunen, May 16 2015

Keywords

Comments

These correspond to the maximal (lexicographically largest) representatives selected from each equivalence class of binary necklaces. See the last example.
Indexing starts from zero, because a(0) = 0 is a special case.
If k is a member then so also is 2*k, i.e., k with 0 appended to the end of its binary representation.
If k is a member then so also is A004755(k), i.e., k with 1 prepended to the front of its binary representation.
One obtains A065609 if one erases the most significant bit of each term [as A053645(a(n))] and then discards any zero-terms produced from the terms that originally were powers of two (A000079).
First differs from A328607 in lacking 108, with binary expansion 1101100. If we define a dual-necklace to be a finite sequence that is lexicographically maximal (not minimal) among all of its cyclic rotations, these are numbers whose binary expansion, without the most significant digit, is a dual-necklace. - Gus Wiseman, Nov 04 2019

Examples

			For n = 5, with binary representation "101", if we rotate other bits than the most significant bit (that is, only the two rightmost digits "01") one step to either direction, we get "110" = 6 > 5, so 5 can be made larger by such rotations, and thus is NOT included in this sequence.
For n = 6, with binary representation "110", no such rotation will yield a larger number, and thus 6 is included in this sequence.
For n = 28, with binary representation "11100", if we rotate non-msb bits towards right, we get additional numbers 22, 19 and 25 (with binary representations "10110", "10011", "11001") before coming to 28 again, and 28 is the largest of these numbers, thus 28 is included in this sequence.
  Also, if we discard the most significant bit of each and consider them just as binary strings, then A053645(28) = 12 is the lexicographically largest representative of {"1100", "0110", "0011", "1001"}, which is the complete set of representatives for a particular equivalence class of binary necklaces, obtained by rotating all bits of binary string "1100" successively towards right or left.
		

Crossrefs

Complement: A257739.
Odd terms: A000225.
Subsequence of A065609.
Subsequence: A258003.
The non-dual version is A328668.
The version involving all digits is A065609.
The non-dual reversed version is A328607.
Numbers whose reversed binary expansion is a necklace are A328595.
Binary necklaces are A000031.
Necklace compositions are A008965.

Programs

  • Mathematica
    reckQ[q_]:=Array[OrderedQ[{RotateRight[q,#],q}]&,Length[q]-1,1,And];
    Select[Range[0,110],#<=1||reckQ[Rest[IntegerDigits[#,2]]]&] (* Gus Wiseman, Nov 04 2019 *)

A004757 Binary expansion starts 101.

Original entry on oeis.org

5, 10, 11, 20, 21, 22, 23, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185
Offset: 1

Views

Author

Keywords

Examples

			22 in binary is 10110, so 22 is in sequence.
		

Crossrefs

Cf. A004754 (10), A004755 (11), A004756 (100), A004758 (110), A004759 (111).

Programs

  • Haskell
    import Data.List (transpose)
    a004757 n = a004757_list !! (n-1)
    a004757_list = 5 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004757_list
    -- Reinhard Zumkeller, Dec 04 2015
    
  • Mathematica
    Table[n + 4*2^Floor@ Log2@ n, {n, 57}] (* or *)
    w = {1, 0, 1}; Select[Range[5, 185], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* Michael De Vlieger, Aug 10 2016 *)
    Select[Range[5,200],Take[IntegerDigits[#,2],3]=={1,0,1}&] (* Harvey P. Dale, Aug 26 2016 *)
  • PARI
    a(n)=n+4*2^floor(log(n)/log(2))
    
  • Python
    def A004757(n): return n+(2<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 4*[n==0].
a(n) = n + 4 * 2^floor(log_2(n)) = A004756(n) + A053644(n).
a(2^m+k) = 5*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
Showing 1-10 of 24 results. Next