login
A179531
a(0)= 0, a(1)= 1; for n>1, a(n) = a(n-2) - min{a(n-1),n} if that number is positive, otherwise a(n) = a(n-2) + max{a(n-1),n}.
1
0, 1, 2, 4, 6, 10, 16, 3, 13, 16, 3, 13, 16, 29, 2, 27, 29, 10, 19, 29, 48, 8, 40, 48, 16, 32, 48, 5, 43, 48, 13, 35, 48, 2, 46, 48, 10, 38, 48, 86, 8, 78, 86, 35, 51, 86, 5, 81, 86, 32, 54, 86, 2, 84, 86, 29, 57, 86, 143, 27, 116, 143, 54, 89, 143, 24, 119, 143, 51, 92, 143, 21, 122, 143, 48, 95, 143, 18, 125, 143, 45, 98, 143, 15, 128, 143, 42, 101, 143, 12
OFFSET
0,3
COMMENTS
The graphic representation shows the structure.
LINKS
EXAMPLE
a(0) = 0; a(1) = 1;
a(2) = 0 + max(1,2) = 2;
a(3) = 1 + max(2,3) = 4.
MAPLE
a0:=0:a1:=1:for n from 2 to 200 do: a2:=a0-min(a1, n): if a2 >0 then
printf(`%d, `, a2):a0:=a1:a1:=a2:else a2:=a0+max(a1, n):a0:=a1:a1:=a2:printf(`%d, `, a2):fi:od:
MATHEMATICA
t={0, 1}; Do[s=t[[-2]]-Min[n, t[[-1]]]; If[s<=0, s=t[[-2]]+Max[n, t[[-1]]]]; AppendTo[t, s], {n, 2, 10}]; t
CROSSREFS
Cf. A005132.
Sequence in context: A355108 A060168 A113117 * A134682 A327408 A083814
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jan 08 2011
STATUS
approved