Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #25 Feb 14 2018 14:54:04
%S 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,
%T 48,5,43,48,13,35,48,2,46,48,10,38,48,86,8,78,86,35,51,86,5,81,86,32,
%U 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
%N 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}.
%C The graphic representation shows the structure.
%H Michel Lagneau, <a href="/A179531/b179531.txt">Table of n, a(n) for n = 0..5000</a>
%e a(0) = 0; a(1) = 1;
%e a(2) = 0 + max(1,2) = 2;
%e a(3) = 1 + max(2,3) = 4.
%p a0:=0:a1:=1:for n from 2 to 200 do: a2:=a0-min(a1,n): if a2 >0 then
%p printf(`%d,`,a2):a0:=a1:a1:=a2:else a2:=a0+max(a1,n):a0:=a1:a1:=a2:printf(`%d, `,a2):fi:od:
%t 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
%Y Cf. A005132.
%K nonn
%O 0,3
%A _Michel Lagneau_, Jan 08 2011