A126606 Fixed point of transformation of the seed sequence {0,2}.
0, 2, 2, 4, 2, 6, 4, 6, 2, 8, 6, 10, 4, 10, 6, 8, 2, 10, 8, 14, 6, 16, 10, 14, 4, 14, 10, 16, 6, 14, 8, 10, 2, 12, 10, 18, 8, 22, 14, 20, 6, 22, 16, 26, 10, 24, 14, 18, 4, 18, 14, 24, 10, 26, 16, 22, 6, 20, 14, 22, 8, 18, 10, 12, 2, 14, 12, 22, 10, 28, 18, 26, 8, 30, 22, 36, 14, 34, 20, 26
Offset: 1
Keywords
Examples
Triangle begins: {0,2}, {0,2,2}, {0,2,2,4,2}, {0,2,2,4,2,6,4,6,2}, {0,2,2,4,2,6,4,6,2,8,6,10,4,10,6,8,2}.
Crossrefs
Cf. A002487.
Programs
-
Mathematica
s={0,2}; Do[t=s;ti=1; Do[If[EvenQ[su=s[[i]]+s[[i+1]]],t=Insert[t,su,i+ti], t=Insert[t,Abs[s[[i]]-s[[i+1]]],i+ti]];ti++,{i,Length[s]-1}];s=t,{8}];s a[1]=0;a[2]=2;a[n_]:=If[EvenQ[n+1],a[(n+1)/2],a[(n)/2]+a[(n+2)/2]];Table[a[n],{n,100}] (* Vincenzo Librandi, May 09 2015 *)
-
Sage
def A126606(n): M = [2, 0] for b in n.bits(): M[b] = M[0] + M[1] return M[1] print([A126606(n) for n in (0..79)]) # Peter Luschny, Nov 28 2017
Formula
a(n) = 2 * A002487(n - 1). - Reikku Kulon, Oct 05 2008
a(1) = 0, a(2) = 2; for n>0: a(2n+1) = a(n+1) and a(2n) = a(n) + a(n+1). - Tom Edgar, May 08 2015
Comments