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

A219608 Odd terms in A060142.

Original entry on oeis.org

1, 3, 7, 9, 15, 19, 25, 31, 33, 39, 51, 57, 63, 67, 73, 79, 97, 103, 115, 121, 127, 129, 135, 147, 153, 159, 195, 201, 207, 225, 231, 243, 249, 255, 259, 265, 271, 289, 295, 307, 313, 319, 385, 391, 403, 409, 415, 451, 457, 463, 481, 487, 499, 505, 511, 513
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 26 2012

Keywords

Comments

a(n) = A060142(A026351(n));
a(n+1) - a(n) = 2 * A219609(n).

Programs

  • Haskell
    a219608 n = a219608_list !! (n-1)
    a219608_list = filter odd a060142_list

A062880 Zero together with the numbers which can be written as a sum of distinct odd powers of 2.

Original entry on oeis.org

0, 2, 8, 10, 32, 34, 40, 42, 128, 130, 136, 138, 160, 162, 168, 170, 512, 514, 520, 522, 544, 546, 552, 554, 640, 642, 648, 650, 672, 674, 680, 682, 2048, 2050, 2056, 2058, 2080, 2082, 2088, 2090, 2176, 2178, 2184, 2186, 2208, 2210, 2216, 2218, 2560, 2562
Offset: 0

Views

Author

Antti Karttunen, Jun 26 2001

Keywords

Comments

Binary expansion of n does not contain 1-bits at even positions.
Integers whose base-4 representation consists of only 0's and 2's.
Every nonnegative even number is a unique sum of the form a(k)+2*a(l); moreover, this sequence is unique with such property. - Vladimir Shevelev, Nov 07 2008
Also numbers such that the digital sum base 2 and the digital sum base 4 are in a ratio of 2:4. - Michel Marcus, Sep 23 2013
From Gus Wiseman, Jun 10 2020: (Start)
Numbers k such that the k-th composition in standard order has all even parts. The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. For example, the sequence of all compositions into even parts begins:
0: () 520: (6,4) 2080: (6,6)
2: (2) 522: (6,2,2) 2082: (6,4,2)
8: (4) 544: (4,6) 2088: (6,2,4)
10: (2,2) 546: (4,4,2) 2090: (6,2,2,2)
32: (6) 552: (4,2,4) 2176: (4,8)
34: (4,2) 554: (4,2,2,2) 2178: (4,6,2)
40: (2,4) 640: (2,8) 2184: (4,4,4)
42: (2,2,2) 642: (2,6,2) 2186: (4,4,2,2)
128: (8) 648: (2,4,4) 2208: (4,2,6)
130: (6,2) 650: (2,4,2,2) 2210: (4,2,4,2)
136: (4,4) 672: (2,2,6) 2216: (4,2,2,4)
138: (4,2,2) 674: (2,2,4,2) 2218: (4,2,2,2,2)
160: (2,6) 680: (2,2,2,4) 2560: (2,10)
162: (2,4,2) 682: (2,2,2,2,2) 2562: (2,8,2)
168: (2,2,4) 2048: (12) 2568: (2,6,4)
170: (2,2,2,2) 2050: (10,2) 2570: (2,6,2,2)
512: (10) 2056: (8,4) 2592: (2,4,6)
514: (8,2) 2058: (8,2,2) 2594: (2,4,4,2)
(End)

Crossrefs

Cf. A000695.
Except for first term, n such that A063694(n) = 0. Binary expansion is given in A062033.
Interpreted as Zeckendorf expansion: A062879.
Central diagonal of arrays A163357 and A163359.
Even partitions are counted by A035363.
Numbers with an even number of 1's in binary expansion are A001969.
Numbers whose binary expansion has even length are A053754.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Compositions without even parts are A060142.
- Sum is A070939.
- Product is A124758.
- Strict compositions are A233564.
- Heinz number is A333219.
- Number of distinct parts is A334028.

Programs

  • C
    uint32_t a_next(uint32_t a_n) { return (a_n + 0x55555556) & 0xaaaaaaaa; } /* Falk Hüffner, Jan 22 2022 */
    
  • Haskell
    a062880 n = a062880_list !! n
    a062880_list = filter f [0..] where
       f 0 = True
       f x = (m == 0 || m == 2) && f x'  where (x', m) = divMod x 4
    -- Reinhard Zumkeller, Nov 20 2012
    
  • Maple
    [seq(a(j),j=0..100)]; a := n -> add((floor(n/(2^i)) mod 2)*(2^((2*i)+1)),i=0..floor_log_2(n+1));
  • Mathematica
    b[n_] := BitAnd[n, Sum[2^k, {k, 0, Log[2, n] // Floor, 2}]]; Select[Range[ 0, 10^4], b[#] == 0&] (* Jean-François Alcover, Feb 28 2016 *)
  • Python
    def A062880(n): return int(bin(n)[2:],4)<<1 # Chai Wah Wu, Aug 21 2023

Formula

a(n) = 2 * A000695(n). - Vladimir Shevelev, Nov 07 2008
From Robert Israel, Apr 10 2018: (Start)
a(2*n) = 4*a(n).
a(2*n+1) = 4*a(n)+2.
G.f. g(x) satisfies: g(x) = 4*(1+x)*g(x^2)+2*x/(1-x^2). (End)

A004718 The Danish composer Per Nørgård's "infinity sequence", invented in an attempt to unify in a perfect way repetition and variation: a(2n) = -a(n), a(2n+1) = a(n) + 1, a(0) = 0.

Original entry on oeis.org

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

Views

Author

Jorn B. Olsson (olsson(AT)math.ku.dk)

Keywords

Comments

Minima are at n=2^i-2, maxima at 2^i-1, zeros at A083866.
a(n) has parity of Thue-Morse sequence on {0,1} (A010060).
a(n) = A000120(n) for all n in A060142.
The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.
Comment from Michael Nyvang on the "iris" score on the "Voyage into the golden screen" video, Dec 31 2018: That is A004718 on the cover in the 12-tone tempered chromatic scale. The music - as far as I recall - is constructed from this base by choosing subsequences out of this sequence in what Per calls 'wave lengths', and choosing different scales modulo (to-tone, overtones on one fundamental, etc). There quite a lot more to say about this, but I believe this is the foundation. - N. J. A. Sloane, Jan 05 2019
From Antti Karttunen, Mar 09 2019: (Start)
This sequence can be represented as a binary tree. After a(0) = 0 and a(1) = 1, each child to the left is obtained by negating the parent node's contents, and each child to the right is obtained by adding one to the parent's contents:
0
|
...................1...................
-1 2
1......../ \........0 -2......../ \........3
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
-1 2 0 1 2 -1 -3 4
1 0 -2 3 0 1 -1 2 -2 3 1 0 3 -2 -4 5
etc.
Sequences A323907, A323908 and A323909 are in bijective correspondence with this sequence and their terms are all nonnegative.
(End)

Crossrefs

Cf. A083866 (indices of 0's), A256187 (first differences), A010060 (mod 2), A343029, A343030.

Programs

  • Haskell
    import Data.List (transpose)
    a004718 n = a004718_list !! n
    a004718_list = 0 : concat
       (transpose [map (+ 1) a004718_list, map negate $ tail a004718_list])
    -- Reinhard Zumkeller, Mar 19 2015, Nov 10 2012
    
  • Maple
    f:=proc(n) option remember; if n=0 then RETURN(0); fi; if n mod 2 = 0 then RETURN(-f(n/2)); else RETURN(f((n-1)/2)+1); fi; end;
  • Mathematica
    a[n_?EvenQ] := a[n]= -a[n/2]; a[0]=0; a[n_] := a[n]= a[(n-1)/2]+1; Table[a[n], {n, 0, 85}](* Jean-François Alcover, Nov 18 2011 *)
    Table[Fold[If[#2 == 0, -#1, #1 + 1] &, IntegerDigits[n, 2]], {n, 0, 85}] (* Michael De Vlieger, Jun 30 2016 *)
  • PARI
    a=vector(100); a[1]=1; a[2]=-1; for(n=3,#a,a[n]=if(n%2,a[n\2]+1,-a[n\2])); a \\ Charles R Greathouse IV, Nov 18 2011
    
  • PARI
    apply( {A004718(n)=[n=if(b,n+1,-n)|b<-binary(n+n=0)];n}, [0..77]) \\ M. F. Hasler, Jun 13 2025
    
  • Python
    # from first formula
    from functools import reduce
    def f(s, b): return s + 1 if b == '1' else -s
    def a(n): return reduce(f, [0] + list(bin(n)[2:]))
    print([a(n) for n in range(86)]) # Michael S. Branicky, Apr 03 2021
    
  • Python
    # via recursion
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def a(n): return 0 if n == 0 else (a((n-1)//2)+1 if n%2 else -a(n//2))
    print([a(n) for n in range(86)]) # Michael S. Branicky, Apr 03 2021
    
  • Python
    from itertools import groupby
    def A004718(n):
        c = 0
        for k, g in groupby(bin(n)[2:]):
            c = c+len(list(g)) if k == '1' else (-c if len(list(g))&1 else c)
        return c # Chai Wah Wu, Mar 02 2023

Formula

Write n in binary and read from left to right, starting with 0 and interpreting 1 as "add 1" and 0 as "change sign". For example 19 = binary 10011, giving 0 -> 1 -> -1 -> 1 -> 2 -> 3, so a(19) = 3.
G.f.: sum{k>=0, x^(2^k)/[1-x^(2*2^k)] * prod{l=0, k-1, x^(2^l)-1}}.
The g.f. satisfies F(x^2)*(1-x) = F(x)-x/(1-x^2).
a(n) = (2 * (n mod 2) - 1) * a(floor(n/2)) + n mod 2. - Reinhard Zumkeller, Mar 20 2015
Zumkeller's formula implies that a(2n) = -a(n), and so a(n) = a(4n) = a(16n) = .... - N. J. A. Sloane, Dec 31 2018
From Kevin Ryde, Apr 17 2021: (Start)
a(n) = (-1)^t * (t+1 - a(n-1)) where t = A007814(n) is the 2-adic valuation of n.
a(n) = A343029(n) - A343030(n). (End)
-(log_2(n+2)-1) <= a(n) <= log_2(n+1). - Charles R Greathouse IV, Nov 15 2022

Extensions

Edited by Ralf Stephan, Mar 07 2003

A026351 a(n) = floor(n*phi) + 1, where phi = (1+sqrt(5))/2.

Original entry on oeis.org

1, 2, 4, 5, 7, 9, 10, 12, 13, 15, 17, 18, 20, 22, 23, 25, 26, 28, 30, 31, 33, 34, 36, 38, 39, 41, 43, 44, 46, 47, 49, 51, 52, 54, 56, 57, 59, 60, 62, 64, 65, 67, 68, 70, 72, 73, 75, 77, 78, 80, 81, 83, 85, 86, 88, 89, 91, 93, 94, 96, 98, 99
Offset: 0

Views

Author

Keywords

Comments

a(n)=least k such that s(k)=n, where s=A026350.
a(n)=position of n-th 1 in A096270.
From Wolfdieter Lang, Jun 27 2011: (Start)
a(n) = A(n)+1, with Wythoff sequence A(n)=A000201(n), n>=1, and A(0)=0.
a(n) = -floor(-n*phi). Recall that floor(-x) = -(floor(x)+1) if x is not integer and -floor(x) otherwise.
An exhaustive and disjoint decomposition of the integers is given by the following two Wythoff sequences A' and B: A'(0):=-1 (not 0), A'(-n):=-a(n)=-(A(n)+1), n>=1, A'(n) = A(n), n>=1, and B(-n):=-(B(n)+1)= -A026352(n), n>=1, with B(n)=A001950(n), n>=1, and B(0)=0.
(End)
Where odd terms in A060142 occur: A060142(a(n)) = A219608(n). - Reinhard Zumkeller, Nov 26 2012

Crossrefs

Essentially same as A004956. Cf. A000201.
Complement of A026352.
Cf. A283733 (partial sums).

Programs

  • Haskell
    import Data.List (findIndices)
    a026351 n = a026351_list !! n
    a026351_list = findIndices odd a060142_list
    -- Reinhard Zumkeller, Nov 26 2012
    
  • Mathematica
    Table[Floor[n*GoldenRatio] + 1, {n, 0, 100}] (* T. D. Noe, Apr 15 2011 *)
  • Python
    from math import isqrt
    def A026351(n): return (n+isqrt(5*n**2)>>1)+1 # Chai Wah Wu, Aug 17 2022

A086747 Baum-Sweet sequence: a(n) = 1 if binary representation of n contains no block of consecutive zeros of odd length; otherwise a(n) = 0.

Original entry on oeis.org

0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0
Offset: 0

Views

Author

N. J. A. Sloane, Sep 12 2003

Keywords

Comments

It appears that the positions of 1's are given by sequence A060142. - R. J. Mathar, Apr 19 2013
This follows from the definition of the sequence: 4x appends an even number of zeros, while 2x+1 appends a 1. - Charles R Greathouse IV, Oct 21 2013
From Kevin Ryde, Jan 23 2020: (Start)
Baum and Sweet consider Laurent series with coefficients mod 2 (GF2[1/x]) and continued fractions developed from such series. One they consider is the unique solution to f(x)^3 + (1/x)*f(x) + 1 = 0, which is f(x) = 1 + 1/x + 0/x^2 + 1/x^3 + ... The coefficients of f are the Baum-Sweet sequence, which is the present sequence except a(0)=1.
Baum and Sweet (remark with theorem 2) note that term f_n/x^n has coefficient f_n = 1 if and only if n has only even runs of 0-bits in its binary expansion. They write such f_n just for n>=1, but the constant term 1 in f(x) would be an f_0 = 1.
This bitwise form follows from the generating function solution by firstly x instead of 1/x so g(x)^3 + x*g(x) + 1 = 0, then f(x)^2=f(x^2) which is true of any series with coefficients mod 2, then multiply through by g(x) so g(x) = x*g(x^2) + g(x^4). x*g(x^2) copies a(n) to odd terms a(2n+1) (so its own odd bisection). g(x^4) copies a(n) to a(4n) similarly. Nothing is copied to 4n+2 so those terms are 0. These are the recurrence below. Repeatedly applied, even-length runs of 0-bits are skipped until reaching final a(0)=1.
The bitwise form (rather than f(x) solution) is often used as the definition of the sequence. It can be recognized by a state machine, per Allouche and Shallit. They include a(0)=1 from Baum and Sweet's series (which Merta, and Winter et al., follow too).
The choice of a(0)=0 or a(0)=1 in a bitwise definition is whether n=0 comprises one 0-bit, or no bits at all. A strong argument can be made for a(0)=1 by noting that high 0-bits are not considered when testing runs of 0s in an n>=1, and ignoring all high 0s in n=0 leaves an empty bit string, which is no odd run of 0s. Allouche and Shallit's state A skips optional leading 0s explicitly. Their output value 1 there gives a(0)=1 for n=0 as any number of 0-bits (none, one, more).
(End)

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 157.

Crossrefs

Programs

  • Maple
    isNotA086747 := proc(n)
        local csl,b,i ;
        csl := 0 ;
        b := convert(n,base,2) ;
        for i from 1 to nops(b) do
            if op(i,b) = 1 then
                if type(csl,'odd') then
                    return true ;
                end if;
                csl := 0 ;
            else
                csl := csl+1 ;
            end if;
        end do:
        type(csl,'odd') ;
    end proc:
    A086747 := proc(n)
        if isNotA086747(n) then
            0;
        else
            1;
        end if;
    end proc: # R. J. Mathar, Apr 19 2013
  • Mathematica
    a[n_] := Block[{b = Plus @@ Union@ Mod[ Length@# & /@ Select[ Union@ Split@ IntegerDigits[n, 2], MemberQ[ #, 0] &], 2]}, If[b == 0, 1, 0]]; a[0] = 1; Table[a@n, {n, 0, 104}] (* Robert G. Wilson v, May 03 2010 *)
    a[0] = 1; a[1] = 1; a[n_] := a[n] = Block[{k = n}, While[ Mod[k, 4] == 0, k /= 4]; If[ OddQ@k, a[(k - 1)/2], 0]]; Table[a@n, {n, 0, 104}] (* Robert G. Wilson v, May 03 2010 *)
    Nest[Partition[ Flatten[ # /. {{0, 0} -> {0, 0, 0, 0}, {0, 1} -> {1, 0, 0, 1}, {1, 0} -> {0, 1, 0, 0}, {1, 1} -> {1, 1, 0, 1}}], 2] &, {1, 1}, 6] // Flatten (* Robert G. Wilson v, May 03 2010 *)
  • PARI
    a(n)=if(n<3,n<2,if(n%2,a(n\2),n%4==0&&a(n/4))) \\ Charles R Greathouse IV, Oct 21 2013
    
  • PARI
    a(n) = if(n==0,0, my(z=0); for(i=0,logint(n,2), if(bittest(n,i), if(z%2,return(0));z=0, z++)); 1); \\ Kevin Ryde, Jan 23 2020
    
  • Python
    from itertools import groupby
    def a(n): return int(all(len(list(g))%2 == 0 or k == '1' for k, g in groupby(bin(n)[2:])))
    print([a(n) for n in range(105)]) # Michael S. Branicky, Aug 27 2021

Formula

From Kevin Ryde, Jan 23 2020: (Start)
Let g(x) = 1 + Sum_{n>=1} a(n)*x^n. Satisfies g(x)^3 + x*g(x) + 1 = 0 with coefficients mod 2 [Baum and Sweet].
Satisfies g(x) = x*g(x^2) + g(x^4).
a(2n+1) = a(n), for n>=1 (or for all n if a(0)=1). a(4n) = a(n). a(4n+2) = 0.
Morphism A->AB, B->CB, C->BD, D->DD starting A and final mapping A->a(0), B->1, C->0, D->0 [Allouche, section 2.4 example 4].
a(n)=1 if A316831(n)=1, a(n)=0 otherwise.
With a(0)=1, pairwise morphism 00->0000, 01->1001, 10->0100, 11->1101 starting 11. [Wikipedia "Gandalf61"]
(End)

Extensions

More terms from Ray Chandler, Sep 14 2003
a(0) changed to 0 by N. J. A. Sloane, Dec 05 2019

A084471 Change 0 to 00 in binary representation of n.

Original entry on oeis.org

1, 4, 3, 16, 9, 12, 7, 64, 33, 36, 19, 48, 25, 28, 15, 256, 129, 132, 67, 144, 73, 76, 39, 192, 97, 100, 51, 112, 57, 60, 31, 1024, 513, 516, 259, 528, 265, 268, 135, 576, 289, 292, 147, 304, 153, 156, 79, 768, 385, 388, 195, 400, 201, 204, 103, 448, 225
Offset: 1

Views

Author

Reinhard Zumkeller, May 27 2003

Keywords

Comments

a(n) = n iff n = 2^k - 1, k>0.
A023416(a(n))=A023416(n)*2; A000120(a(n))=A000120(n);

Crossrefs

Cf. A084472(n)=A007088(a(n)), A084473, A038573.
Ordered terms are in A060142.
Column k=2 of A340666.
Cf. A088698, A175047. - Robert G. Wilson v, Dec 10 2009

Programs

  • Haskell
    a084471 1 = 1
    a084471 x = 2 * (2 - d) * a084471 x' + d  where (x',d) = divMod x 2
    -- Reinhard Zumkeller, Jul 16 2012
  • Maple
    a:= n-> Bits[Join](subs(0=[0$2][], Bits[Split](n))):
    seq(a(n), n=1..60);  # Alois P. Heinz, Jan 15 2021
  • Mathematica
    f[n_] := FromDigits[Flatten[IntegerDigits[n, 2] /. {0 -> {0, 0}}], 2]; Array[f, 60] (* Robert G. Wilson v, Dec 10 2009 *)

Formula

a(1)=1, a(2*k+1)=2*a(k)+1, a(2*k)=4*a(k).

A004957 a(n) = ceiling(n*phi^2), where phi is the golden ratio, A001622.

Original entry on oeis.org

0, 3, 6, 8, 11, 14, 16, 19, 21, 24, 27, 29, 32, 35, 37, 40, 42, 45, 48, 50, 53, 55, 58, 61, 63, 66, 69, 71, 74, 76, 79, 82, 84, 87, 90, 92, 95, 97, 100, 103, 105, 108, 110, 113, 116, 118, 121, 124, 126, 129, 131, 134
Offset: 0

Views

Author

Keywords

Crossrefs

Essentially same as A026352.
Cf. A001622.

Programs

  • Haskell
    import Data.List (findIndices)
    a004957 n = a004957_list !! n
    a004957_list = findIndices even a060142_list
    -- Reinhard Zumkeller, Nov 26 2012

Formula

A060142(a(n)) = 4 * A060142(n). - Reinhard Zumkeller, Nov 26 2012

A060140 Ordered set S defined by these rules: 0 and 1 are in S and if x is a nonzero number in S, then 3x and 9x+1 are in S.

Original entry on oeis.org

0, 1, 3, 9, 10, 27, 28, 30, 81, 82, 84, 90, 91, 243, 244, 246, 252, 253, 270, 271, 273, 729, 730, 732, 738, 739, 756, 757, 759, 810, 811, 813, 819, 820, 2187, 2188, 2190, 2196, 2197, 2214, 2215, 2217, 2268, 2269, 2271, 2277, 2278, 2430, 2431, 2433, 2439
Offset: 0

Views

Author

Clark Kimberling, Mar 05 2001

Keywords

Comments

The numbers of the form 9x+1 occupy the same positions in S that 1 occupies in the infinite Fibonacci word (A003849).
These are Fibternary numbers: numbers whose ternary representations consist only of zeros and ones and do not have two consecutive ones. The sequence of Fibternary numbers can be constructed by writing out the Zeckendorf representations of nonnegative integers and then evaluating the result in ternary. These numbers are similar to Fibbinary numbers A003714, Tribbinary numbers A060140, and Tribternary numbers A356823. The number of Fibternary numbers less than any power of three is a Fibonacci number. We can generate Fibternary numbers recursively: Start by adding 0 and 1 to the sequence. Then, if x is a number in the sequence add 3x and 9x+1 to the sequence. Every nonnegative integer can be written as the sum of four Fibternary numbers. Every number has a Fibternary multiple. - Tanya Khovanova and PRIMES STEP Senior group, Aug 30 2022

Crossrefs

Programs

  • Mathematica
    FromDigits[IntegerDigits[#, 2], 3] & /@ Select[Range[0, 165], BitAnd[#, 2*#] == 0 &] (* Amiram Eldar, Oct 28 2023 *)
  • Python
    import heapq
    from itertools import islice
    def agen(): # generator of terms, using recursion in Comments
        yield 0; x, h = None, [1]
        while True:
            x = heapq.heappop(h)
            yield x
            for t in [3*x, 9*x+1]:  heapq.heappush(h, t)
    print(list(islice(agen(), 51))) # Michael S. Branicky, Aug 30 2022
    
  • Python
    def A060140(n):
        tlist, s = [1,2], 0
        while tlist[-1]+tlist[-2] <= n:
            tlist.append(tlist[-1]+tlist[-2])
        for d in tlist[::-1]:
            s <<= 1
            if d <= n:
                s += 1
                n -= d
        return int(bin(s)[2:],3) # Chai Wah Wu, May 22 2025

Formula

a(n) = A005836(A003714(n)+1). - Amiram Eldar, Oct 28 2023

A060138 Ordered set S defined by these rules: 0 and 2 are in S and if x is a nonzero number in S, then 2x-1 and 4x are in S.

Original entry on oeis.org

0, 2, 3, 5, 8, 9, 12, 15, 17, 20, 23, 29, 32, 33, 36, 39, 45, 48, 57, 60, 63, 65, 68, 71, 77, 80, 89, 92, 95, 113, 116, 119, 125, 128, 129, 132, 135, 141, 144, 153, 156, 159, 177, 180, 183, 189, 192, 225, 228, 231, 237, 240, 249, 252, 255, 257, 260, 263, 269, 272, 281
Offset: 0

Views

Author

Clark Kimberling, Mar 05 2001

Keywords

Comments

The numbers 2 and 4x occupy the same positions in S that 1 occupies in the infinite Fibonacci word (A003849).

Crossrefs

Cf. A060142.

Extensions

Missing term a(55)=257 added by Ivan Neretin, Jun 19 2018

A353654 Numbers whose binary expansion has the same number of trailing 0 bits as other 0 bits.

Original entry on oeis.org

1, 3, 7, 10, 15, 22, 26, 31, 36, 46, 54, 58, 63, 76, 84, 94, 100, 110, 118, 122, 127, 136, 156, 172, 180, 190, 204, 212, 222, 228, 238, 246, 250, 255, 280, 296, 316, 328, 348, 364, 372, 382, 392, 412, 428, 436, 446, 460, 468, 478, 484, 494, 502, 506, 511, 528, 568
Offset: 1

Views

Author

Mikhail Kurkov, Jul 15 2022

Keywords

Comments

Numbers k such that A007814(k) = A086784(k).
To reproduce the sequence through itself, use the following rule: if binary 1xyz is a term then so are 11xyz and 10xyz0 (except for 1 alone where 100 is not a term).
The number of terms with bit length k is equal to Fibonacci(k-1) for k > 1.
Conjecture: 2*A247648(n-1) + 1 with rewrite 1 -> 1, 01 -> 0 applied to binary expansion is the same as a(n) without trailing 0 bits in binary.
Odd terms are positive Mersenne numbers (A000225), because there is no 0 in their binary expansion. - Bernard Schott, Oct 12 2022

Crossrefs

Cf. A356385 (first differences).
Subsequences with same number k of trailing 0 bits and other 0 bits: A000225 (k=0), 2*A190620 (k=1), 4*A357773 (k=2), 8*A360573 (k=3).

Programs

  • Maple
    N:= 10: # for terms <= 2^N
    S:= {1};
    for d from 1 to N do
      for k from 0 to d/2-1 do
        B:= combinat:-choose([$k+1..d-2],k);
        S:= S union convert(map(proc(t) local s; 2^d - 2^k - add(2^(s),s=t) end proc,B),set);
    od od:
    sort(convert(S,list)); # Robert Israel, Sep 21 2023
  • Mathematica
    Join[{1}, Select[Range[2, 600], IntegerExponent[#, 2] == Floor[Log2[# - 1]] - DigitCount[# - 1, 2, 1] &]] (* Amiram Eldar, Jul 16 2022 *)
  • PARI
    isok(k) = if (k==1, 1, (logint(k-1, 2)-hammingweight(k-1) == valuation(k, 2))); \\ Michel Marcus, Jul 16 2022
    
  • Python
    from itertools import islice, count
    def A353654_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:(m:=(~n & n-1).bit_length()) == bin(n>>m)[2:].count('0'),count(max(startvalue,1)))
    A353654_list = list(islice(A353654_gen(),30)) # Chai Wah Wu, Oct 14 2022

Formula

a(n) = a(n-1) + A356385(n-1) for n > 1 with a(1) = 1.
Conjectured formulas: (Start)
a(n) = 2^g(n-1)*(h(n-1) + 2^A000523(h(n-1))*(2 - g(n-1))) for n > 2 with a(1) = 1, a(2) = 3 where f(n) = n - A130312(n), g(n) = [n > 2*f(n)] and where h(n) = a(f(n) + 1).
a(n) = 1 + 2^r(n-1) + Sum_{k=1..r(n-1)} (1 - g(s(n-1, k)))*2^(r(n-1) - k) for n > 1 with a(1) = 1 where r(n) = A072649(n) and where s(n, k) = f(s(n, k-1)) for n > 0, k > 1 with s(n, 1) = n.
a(n) = 2*(2 + Sum_{k=1..n-2} 2^(A213911(A280514(k)-1) + 1)) - 2^A200650(n) for n > 1 with a(1) = 1.
A025480(a(n)-1) = A348366(A343152(n-1)) for n > 1.
a(A000045(n)) = 2^(n-1) - 1 for n > 1. (End)
Showing 1-10 of 21 results. Next