%I #35 Nov 17 2022 05:25:01
%S 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,
%T 15,31,31,63,3,7,7,15,7,15,15,31,7,15,15,31,15,31,31,63,7,15,15,31,15,
%U 31,31,63,15,31,31,63,31,63,63,127,3,7,7,15,7,15,15,31,7,15,15,31,15,31,31
%N a(n) = 2^(A000120(n) + 1) - 1, where A000120(n) = number of nonzero bits in n.
%C Essentially the same sequence as A117973 and A001316. The latter entry has much more information. - _N. J. A. Sloane_, Jun 05 2009
%C First differences of A159912; every other term of A038573.
%C Equals Sierpinski's gasket, A047999; as an infinite lower triangular matrix * [1,2,2,2,...] as a vector. - _Gary W. Adamson_, Oct 16 2009
%C a(n) is also the number of cells turned ON at n-th generation in the outward corner version of the Ulam-Warburton cellular automaton of A147562, and a(n) is also the number of Y-toothpicks added at n-th generation in the outward corner version of the Y-toothpick structure of A160120. - _David Applegate_ and _Omar E. Pol_, Jan 24 2016
%H David Applegate, <a href="/A139250/a139250.anim.html">The movie version</a>
%H 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 <a href="/index/Ce#cell">Index entries for sequences related to cellular automata</a>
%H <a href="/index/To#toothpick">Index entries for sequences related to toothpick sequences</a>
%F a(n) = 2^A000120(2n+1) - 1 = A038573(2n+1) = 2*A038573(n) + 1 = A159912(n+1) - A159912(n).
%F a(n) = A160019(n,n). - _Philippe Deléham_, Nov 15 2011
%F a(n) = n - Sum_{k=0..n} (-1)^binomial(n, k). - _Peter Luschny_, Jan 14 2018
%e From _Michael De Vlieger_, Jan 25 2016: (Start)
%e The number n converted to binary, "0" represented by "." for better visibility of 1's, totaling the 1's and calculating the sequence:
%e n Binary Total a(n)
%e 0 -> . -> 0, thus 2^(0+1)-1 = 2-1 = 1
%e 1 -> 1 -> 1, " 2^(1+1)-1 = 4-1 = 3
%e 2 -> 1. -> 1, " 2^(1+1)-1 = 4-1 = 3
%e 3 -> 11 -> 2, " 2^(2+1)-1 = 8-1 = 7
%e 4 -> 1.. -> 1, " 2^(1+1)-1 = 4-1 = 3
%e 5 -> 1.1 -> 2, " 2^(2+1)-1 = 8-1 = 7
%e 6 -> 11. -> 2, " 2^(2+1)-1 = 8-1 = 7
%e 7 -> 111 -> 3, " 2^(3+1)-1 = 16-1 = 15
%e 8 -> 1... -> 1, " 2^(1+1)-1 = 4-1 = 3
%e 9 -> 1..1 -> 2, " 2^(2+1)-1 = 8-1 = 7
%e 10-> 1.1. -> 2, " 2^(2+1)-1 = 8-1 = 7
%e (End)
%t Table[2^(DigitCount[n, 2][[1]] + 1) - 1, {n, 0, 78}] (* or *)
%t Table[2^(Total@ IntegerDigits[n, 2] + 1) - 1, {n, 0, 78}] (* _Michael De Vlieger_, Jan 25 2016 *)
%o (PARI) A159913(n)=2<<norml2(binary(n))-1
%o (Python 3.10+)
%o def A159913(n): return (1<<n.bit_count()+1)-1 # _Chai Wah Wu_, Nov 15 2022
%Y Rows of triangle in A038573 converge to this sequence. - _N. J. A. Sloane_, Jun 05 2009
%Y Cf. A000120, A038573, A047999, A159912, A117973, A001316, A147582, A160121.
%K nonn
%O 0,2
%A _M. F. Hasler_, May 03 2009