A038573 a(n) = 2^A000120(n) - 1.
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, 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, 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
Offset: 0
Examples
9 = 1001 -> 0011 -> 3, so a(9)=3. From _Gary W. Adamson_, Jun 04 2009: (Start) Triangle read by rows: 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; ... 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) The rows of this triangle converge to A159913. - _N. J. A. Sloane_, Jun 05 2009 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
Links
- Seiichi Manyama, Table of n, a(n) for n = 0..8191 (terms 0..1023 from T. D. Noe)
- David Applegate, The movie version
- Michael Gilleland, Some Self-Similar Integer Sequences
- N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
- Index entries for sequences related to cellular automata
- Index entries for sequences related to toothpick sequences
- Index entries for sequences that are fixed points of mappings
Crossrefs
Programs
-
Haskell
a038573 0 = 0 a038573 n = (m + 1) * (a038573 n') + m where (n', m) = divMod n 2 -- Reinhard Zumkeller, Oct 10 2012, Feb 07 2011 (Python 3.10+) def A038573(n): return (1<
Chai Wah Wu, Nov 15 2022 -
Maple
seq(2^convert(convert(n,base,2),`+`)-1, n=0..100); # Robert Israel, Jan 24 2016
-
Mathematica
Array[ 2^Count[ IntegerDigits[ #, 2 ], 1 ]-1&, 100 ] Nest[ Flatten[ # /. a_Integer -> {a, 2a + 1}] &, {0}, 7] (* Robert G. Wilson v, Jan 24 2006 *)
-
PARI
{a(n) = 2^subst(Pol(binary(n)), x, 1) - 1};
-
PARI
a(n) = 2^hammingweight(n)-1; \\ Michel Marcus, Jan 24 2016
Formula
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
a(n) = number of positive integers k < n such that n XOR k = n-k (cf. A115378). - Paul D. Hanna, Jan 21 2006
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
a(n) = (n mod 2 + 1) * a(floor(n/2)) + n mod 2. - Reinhard Zumkeller, Oct 10 2012
a(n) = Sum_{i=1..n} C(n,i) mod 2. - Wesley Ivan Hurt, Nov 17 2017
G.f.: -1/(1 - x) + Product_{k>=0} (1 + 2*x^(2^k)). - Ilya Gutkovskiy, Aug 20 2019
G.f. A(x) = x + x^2*A(x) + (1 + 2*x)*(1 - x^2)*A(x^2). - Michael Somos, Jul 24 2023
Extensions
More terms from Erich Friedman
New definition from N. J. A. Sloane, Mar 01 2008
Comments