%I
%S 2,4,2,8,2,4,2,16,2,4,2,8,2,4,2,32,2,4,2,8,2,4,2,16,2,4,2,8,2,4,2,64,
%T 2,4,2,8,2,4,2,16,2,4,2,8,2,4,2,32,2,4,2,8,2,4,2,16,2,4,2,8,2,4,2
%N a(n) = 2^(k+1) where 2^k is the highest power of 2 dividing n.
%C When read as a triangle in which the nth row has 2^n terms, every row is the last half of the next one. All the terms are powers of 2. First column = 2*A000079.
%C The original definition was: a(n) = (A000265(2n+1)  1) / A000265(2n).
%C a(n) seems to be the denominator of Euler(2*n+1,1) but I have no proof of this.
%C a(n) is also gcd[C(2n,1), C(2n,3), ..., C(2n,2n1)].  _Franz Vrabec_, Oct 22 2012
%C a(n) is also the ratio r(2n) = s2(2n)/s1(2n) where s1(2n) is the sum of the odd unitary divisors of 2n and s2(2n) is the sum of the even unitary divisors of 2n.  _Michel Lagneau_, Dec 19 2013
%C a(n) or a(n)/2 = A006519(n) is known as the Steinhaus sequence in probability theory, proposed as a sequence of asymptotically fair premiums for the St. Petersburg game.  _Peter Kern_, Aug 28 2015
%C After the all1's sequence this is the next sequence in lexicographical order such that the gap between a(n) and the next occurrence of a(n) is given by a(n).  _Scott R. Shannon_, Oct 16 2019
%C First 2^(k1)  1 terms are also the areas of the successive rectangles and squares of width 2 that are adjacent to any of the four sides of the toothpick structure of A139250 after 2^k stages, with k >= 2. For example: if k = 5 the areas after 32 stages are [2, 4, 2, 8, 2, 4, 2, 16, 2, 4, 2, 8, 2, 4, 2] respectively, the same as the first 15 terms of this sequence.  _Omar E. Pol_, Dec 29 2020
%H Antti Karttunen, <a href="/A171977/b171977.txt">Table of n, a(n) for n = 1..16383</a>
%H Sandor Csörgö and Gordon Simons, <a href="http://www.math.uni.wroc.pl/~pms/files/14.2/Abstract/14.2.1.abs.pdf">On Steinhaus' resolution of the St. Petersburg paradox</a>, Probab. Math. Statist. 14 (1993), 157172. MR1321758 (96b:60017).  _Peter Kern_, Aug 28 2015
%H Roger B. Eggleton, Aviezri S. Fraenkel, and R. Jamie Simpson, <a href="http://dx.doi.org/10.1016/0012365X(93)90153K">Beatty sequences and Langford sequences</a>, Graph theory and combinatorics (MarseilleLuminy, 1990). Discrete Math. 111 (1993), no. 13, 165178. MR1210094 (94a:11018). See Example 2.6.  _N. J. A. Sloane_, Mar 18 2012
%H Hugo Steinhaus, <a href="http://pldml.icm.edu.pl/pldml/element/bwmeta1.element.bwnjournalarticlecmv2i1p56bwm">The socalled Petersburg paradox</a>, Colloq. Math. 2 (1949), 5658. MR0039937 (12,619e).
%F a(n) = (A000265(2*n+1)1)/A000265(2*n).
%F a(n) = (n XOR n). XOR the bitwise operation on the two's complement representation for negative integers.  _Peter Luschny_, Jun 01 2011
%F a(n) = A038712(n)+1.  _Franz Vrabec_, Mar 03 2012
%F a(n) = 2^A001511(n).  _Franz Vrabec_, Oct 22 2012
%F a(n) = A046161(n)/A046161(n1).  _Johannes W. Meijer_, Nov 04 2012
%F a(n) = 2^(1 + (A183063(n)/A001227(n))).  _Omar E. Pol_, Nov 06 2018
%F a(n) = 2*A006519(n).  _Antti Karttunen_, Nov 06 2018
%p a := proc(n) local k: k:=1: while frac(n/2^k) = 0 do k := k+1 end do: k := k1: a(n) := 2^(k+1) end: seq(a(n), n=1..63); # _Johannes W. Meijer_, Nov 04 2012
%p seq(2^(1 + padic[ordp](n, 2)), n = 1..63); # _Peter Luschny_, Nov 27 2020
%t Table[BitXor[i,i], {i, 200}] (* _Peter Luschny_, Jun 01 2011 *)
%t a[n_] := 2^(IntegerExponent[n, 2] + 1); Array[a, 100] (* _JeanFrançois Alcover_, May 09 2017 *)
%o (PARI) A171977(n) = 2^(1+valuation(n,2)); \\ _Antti Karttunen_, Nov 06 2018
%Y Cf. A000079, A000265, A006519, A038712, A139250.
%K nonn,tabf
%O 1,1
%A _Paul Curtz_, Nov 19 2010
%E I edited this sequence, based on an email message from the author.  _N. J. A. Sloane_, Nov 20 2010
%E Definition simplified by _N. J. A. Sloane_, Mar 18 2012
