login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A126606
Fixed point of transformation of the seed sequence {0,2}.
4
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,2
COMMENTS
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.
{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)}.
Each row includes the previous one and then continues.
This sequence is analogous to Stern's diatomic series (A002487) but starting with 0,2 instead of 0,1. - Tom Edgar, May 08 2015
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
EXAMPLE
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}.
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 *)
PROG
(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
CROSSREFS
Cf. A002487.
Sequence in context: A096002 A082175 A129292 * A285699 A278229 A233027
KEYWORD
nonn
AUTHOR
Zak Seidov, Mar 13 2007
STATUS
approved