%I #25 May 04 2024 09:23:38
%S 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,
%T 14,8,10,2,12,10,18,8,22,14,20,6,22,16,26,10,24,14,18,4,18,14,24,10,
%U 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
%N Fixed point of transformation of the seed sequence {0,2}.
%C Start with s={0,2} If sum of two neighbor terms sum=s(i)+s(i+1) is even then insert the sum in between, otherwise insert abs(s(i)-s(i+1)); repeat the procedure.
%C {s(i),s(i+1)} => {s(i),s(i)+s(i+1), s(i+1)}, if s(i)+s(i+1) is even, otherwise {s(i),s(i+1)} => {s(i), abs(s(i)-s(i+1)), s(i+1)}.
%C Each row includes the previous one and then continues.
%C This sequence is analogous to Stern's diatomic series (A002487) but starting with 0,2 instead of 0,1. - _Tom Edgar_, May 08 2015
%F a(n) = 2 * A002487(n - 1). - _Reikku Kulon_, Oct 05 2008
%F 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
%e Triangle begins:
%e {0,2},
%e {0,2,2},
%e {0,2,2,4,2},
%e {0,2,2,4,2,6,4,6,2},
%e {0,2,2,4,2,6,4,6,2,8,6,10,4,10,6,8,2}.
%t 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
%t 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 *)
%o (Sage)
%o def A126606(n):
%o M = [2, 0]
%o for b in n.bits():
%o M[b] = M[0] + M[1]
%o return M[1]
%o print([A126606(n) for n in (0..79)]) # _Peter Luschny_, Nov 28 2017
%Y Cf. A002487.
%K nonn
%O 1,2
%A _Zak Seidov_, Mar 13 2007