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.

A038573 a(n) = 2^A000120(n) - 1.

This page as a plain text file.
%I A038573 #123 Aug 21 2025 15:30:47
%S A038573 0,1,1,3,1,3,3,7,1,3,3,7,3,7,7,15,1,3,3,7,3,7,7,15,3,7,7,15,7,15,15,
%T A038573 31,1,3,3,7,3,7,7,15,3,7,7,15,7,15,15,31,3,7,7,15,7,15,15,31,7,15,15,
%U A038573 31,15,31,31,63,1,3,3,7,3,7,7,15,3,7,7,15,7,15,15,31,3,7,7,15,7,15,15,31
%N A038573 a(n) = 2^A000120(n) - 1.
%C A038573 Essentially the same sequence as A001316, which has much more information, and also A159913. - _N. J. A. Sloane_, Jun 05 2009
%C A038573 Smallest number with same number of 1's in its binary expansion as n.
%C A038573 Fixed point of the morphism 0 -> 01, 1 -> 13, 3 -> 37, ... = k -> k, 2k+1, ... starting from a(0) = 0; 1 -> 01 -> 0113 -> 01131337 -> 011313371337377(15) -> ..., . - _Robert G. Wilson v_, Jan 24 2006
%C A038573 From _Gary W. Adamson_, Jun 04 2009: (Start)
%C A038573 As an infinite string, 2^n terms per row starting with "1": (1; 1,3; 1,3,3,7; 1,3,3,7,3,7,7,15; 1,3,3,7,3,7,7,15,3,7,7,15,7,15,15,31;...)
%C A038573 Row sums of that triangle = A027649: (1, 4, 14, 46, 454, ...); where the next row sum = current term of A027649 + next term in finite difference row of A027649, i.e., (1, 3, 10, 32, 100, 308, ...) = A053581. (End)
%C A038573 From _Omar E. Pol_, Jan 24 2016: (Start)
%C A038573 Partial sums give A267700.
%C A038573 a(n) is also the number of cells turned ON at n-th generation of the cellular automaton of A267700 in a 90-degree sector on the square grid.
%C A038573 a(n) is also the number of Y-toothpicks added at n-th generation of the structure of A267700 in a 120-degree sector on the triangular grid. (End)
%C A038573 Row sums of A090971. - _Nikolaos Pantelidis_, Nov 23 2022
%H A038573 Seiichi Manyama, <a href="/A038573/b038573.txt">Table of n, a(n) for n = 0..8191</a> (terms 0..1023 from T. D. Noe)
%H A038573 David Applegate, <a href="/A139250/a139250.anim.html">The movie version</a>
%H A038573 Michael Gilleland, <a href="/selfsimilar.html">Some Self-Similar Integer Sequences</a>
%H A038573 N. J. A. Sloane, <a href="/wiki/Catalog_of_Toothpick_and_CA_Sequences_in_OEIS">Catalog of Toothpick and Cellular Automata Sequences in the OEIS</a>
%H A038573 <a href="/index/Ce#cell">Index entries for sequences related to cellular automata</a>
%H A038573 <a href="/index/To#toothpick">Index entries for sequences related to toothpick sequences</a>
%H A038573 <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>
%F A038573 a(2n) = a(n), a(2n+1) = 2*a(n)+1, a(0) = 0. a(n) = A001316(n)-1 = 2^A000120(n) - 1. - _Daniele Parisse_
%F A038573 a(n) = number of positive integers k < n such that n XOR k = n-k (cf. A115378). - _Paul D. Hanna_, Jan 21 2006
%F A038573 a(n) = f(n, 1) with f(x, y) = if x = 0 then y - 1 else f(floor(x/2), y*(1 + x mod 2)). - _Reinhard Zumkeller_, Nov 21 2009
%F A038573 a(n) = (n mod 2 + 1) * a(floor(n/2)) + n mod 2. - _Reinhard Zumkeller_, Oct 10 2012
%F A038573 a(n) = Sum_{i=1..n} C(n,i) mod 2. - _Wesley Ivan Hurt_, Nov 17 2017
%F A038573 G.f.: -1/(1 - x) + Product_{k>=0} (1 + 2*x^(2^k)). - _Ilya Gutkovskiy_, Aug 20 2019
%F A038573 G.f. A(x) = x + x^2*A(x) + (1 + 2*x)*(1 - x^2)*A(x^2). - _Michael Somos_, Jul 24 2023
%e A038573 9 = 1001 -> 0011 -> 3, so a(9)=3.
%e A038573 From _Gary W. Adamson_, Jun 04 2009: (Start)
%e A038573 Triangle read by rows:
%e A038573   1;
%e A038573   1, 3;
%e A038573   1, 3, 3, 7;
%e A038573   1, 3, 3, 7, 3, 7, 7, 15;
%e A038573   1, 3, 3, 7, 3, 7, 7, 15, 3, 7, 7, 15, 7, 15, 15, 31;
%e A038573   ...
%e A038573 Row sums: (1, 4, 14, 46, ...) = A027649 = last row terms + new set of terms such that row 3 = (1, 3, 3, 7,) + (3, 7, 7, 15) = 14 + 32 = A027649(2) + A053581(3). (End)
%e A038573 The rows of this triangle converge to A159913. - _N. J. A. Sloane_, Jun 05 2009
%e A038573 G.f. = x + x^2 + 3*x^3 + x^4 + 3*x^5 + 3*x^6 + 7*x^7 + x^8 + 3*x^9 + 3*x^10 + 7*x^11 + ... - _Michael Somos_, Jul 24 2023
%p A038573 seq(2^convert(convert(n,base,2),`+`)-1, n=0..100); # _Robert Israel_, Jan 24 2016
%t A038573 Array[ 2^Count[ IntegerDigits[ #, 2 ], 1 ]-1&, 100 ]
%t A038573 Nest[ Flatten[ # /. a_Integer -> {a, 2a + 1}] &, {0}, 7] (* _Robert G. Wilson v_, Jan 24 2006 *)
%o A038573 (PARI) {a(n) = 2^subst(Pol(binary(n)), x, 1) - 1};
%o A038573 (PARI) a(n) = 2^hammingweight(n)-1; \\ _Michel Marcus_, Jan 24 2016
%o A038573 (Haskell)
%o A038573 a038573 0 = 0
%o A038573 a038573 n = (m + 1) * (a038573 n') + m where (n', m) = divMod n 2
%o A038573 -- _Reinhard Zumkeller_, Oct 10 2012, Feb 07 2011
%o A038573 (Python 3.10+)
%o A038573 def A038573(n): return (1<<n.bit_count())-1 # _Chai Wah Wu_, Nov 15 2022
%Y A038573 Cf. A007313, A115378, A073138.
%Y A038573 This is Guy Steele's sequence GS(3, 6) (see A135416).
%Y A038573 Cf. also A000079, A001316, A027649, A053581, A159913, A267700.
%Y A038573 Write n in b-ary, sort digits into increasing order: this sequence (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).
%Y A038573 Column k=0 of A340666.
%K A038573 nonn,easy,nice,changed
%O A038573 0,4
%A A038573 _Marc LeBrun_
%E A038573 More terms from _Erich Friedman_
%E A038573 New definition from _N. J. A. Sloane_, Mar 01 2008