login
a(n) = a(n-1) - floor((a(n-2) + a(n-3))/2), with a(n)=n for n < 3.
2

%I #13 May 22 2021 04:29:47

%S 0,1,2,2,1,-1,-2,-2,0,2,3,2,0,-2,-3,-2,1,4,5,3,-1,-5,-6,-3,3,8,8,3,-5,

%T -10,-9,-1,9,14,10,-1,-13,-17,-10,5,19,22,10,-10,-26,-26,-8,18,35,30,

%U 4,-28,-45,-33,4,43,58,35,-15,-61,-71,-33,33,85,85

%N a(n) = a(n-1) - floor((a(n-2) + a(n-3))/2), with a(n)=n for n < 3.

%C The same sequence, except few initial terms, for 23 of the 27 other seed triples satisfying -1 <= a(0,1,2) <= 1. The four exceptions are {-1,1,0}, {0,0,0}, {0,1,0}, {1,0,0} - all 0's after the seed triple. The sequence starting with {1,-1,0} has ten extra terms, the other 22 variants have between 1 and 9, except {1, 1, -1} which lacks 3 terms.

%t RecurrenceTable[{a[0]==0,a[1]==1,a[2]==2,a[n]==a[n-1]-Floor[(a[n-2] + a[n-3])/2]},a[n],{n,70}] (* _Harvey P. Dale_, Dec 03 2012 *)

%o (Python)

%o ppp =0

%o prpr=1

%o prev=2

%o for n in range(65):

%o cur = prev-(prpr+ppp)//2

%o print(str(ppp), end=',')

%o ppp = prpr

%o prpr= prev

%o prev= cur

%K sign,easy

%O 0,3

%A _Alex Ratushnyak_, Jul 01 2012