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”).

A126597
Triangle read by rows: Start with the row 1,2. To get the next row, do the following: if the sum of two adjacent terms is odd then insert this sum in between them, otherwise insert the absolute value of their difference; repeat the procedure.
0
1, 2, 1, 3, 2, 1, 2, 3, 5, 2, 1, 3, 2, 5, 3, 2, 5, 7, 2, 1, 2, 3, 5, 2, 7, 5, 2, 3, 5, 2, 7, 5, 2, 7, 9, 2, 1, 3, 2, 5, 3, 2, 5, 7, 2, 9, 7, 2, 5, 7, 2, 5, 3, 2, 5, 7, 2, 9, 7, 2, 5, 7, 2, 9, 7, 2, 9, 11, 2, 1, 2, 3, 5, 2, 7, 5, 2, 3, 5, 2, 7, 5, 2, 7, 9, 2, 11, 9, 2, 7, 9, 2, 7, 5, 2, 7, 9, 2, 7, 5, 2, 3, 5, 2, 7
OFFSET
1,2
FORMULA
{s(i),s(i+1)} => {s(i),s(i)+s(i+1), s(i+1)}, if s(i)+s(i+1) is odd, otherwise {s(i),s(i+1)} => {s(i), abs(s(i)-s(i+1)), s(i+1)}.
EXAMPLE
Triangle begins:
1,2
1,3,2
1,2,3,5,2
1,3,2,5,3,2,5,7,2
1,2,3,5,2,7,5,2,3,5,2,7,5,2,7,9,2
1,3,2,5,3,2,5,7,2,9,7,2,5,7,2,5,3,2,5,7,2,9,7,2,5,7,2,9,7,2,9,11,2
MATHEMATICA
s={1, 2}; Do[t=s; ti=1; Do[If[OddQ[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}]; Print[t]; s=t, {8}]
CROSSREFS
Sequence in context: A285731 A114905 A200651 * A261867 A076081 A304089
KEYWORD
nonn,tabf
AUTHOR
Zak Seidov, Mar 13 2007
STATUS
approved