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

A135564
a(n) defined by a(2*n) = a(2*n-2) - (a(n) - 2*a(n-1) + a(n-2)) for n > 2, a(2*n+1) = a(2*n) - (a(n-2) - 2*a(n-3) + a(n-4)), for n > 3, with a(0)=0, a(1)=1, a(2)=3, a(3)=-1, a(4)=-2, a(5)=-3, a(6)=4, a(7)=2.
1
0, 1, 3, -1, -2, -3, 4, 2, 1, 0, 1, 7, -7, -10, 2, 2, 1, -7, 1, 10, -1, -2, -6, -6, 14, 12, 3, -2, -12, 8, 0, -11, 1, -14, 8, 20, -8, -7, -9, -2, 11, -5, 1, 0, 4, 24, 0, -10, -20, -17, 2, -2, 9, -11, 5, 27, 10, 17, -20, -24, 8, 13, 11, -19, -12, 16, 15, 18, -22, -45, -12, 15, 28, -9, -1, 9, 2, 42, -7, -36, -13, -10, 16, 7, -6, -12, 1, 30, -4
OFFSET
0,3
LINKS
FORMULA
a(n) = a(n-2) - (a(floor(n/2)) - 2*a(abs(floor(n/2) -1)) + a(abs(floor(n/2) -2)) ) if (n mod 2) = 0, otherwise a(n-1) - (a(abs(floor(n/2) - 2)) - 2*a(abs(floor(n/2) - 3)) + a(abs(floor(n/2) - 4)).
a(2*n) = a(2*n-2) - (a(n) - 2*a(n-1) + a(n-2)), for n > 2.
a(2*n+1) = a(2*n) - (a(n-2) - 2*a(n-3) + a(n-4)), for n > 3.
MATHEMATICA
a[0]:=0; a[1]:=1; a[2]:=3; a[3]:=-1; a[4]:=-2; a[5]:=-3; a[6]:=4; a[7]:=2;
a[n_]:= a[n]= If[Mod[n, 2]==0, a[n-2] -a[n/2] +2*a[n/2 -1] -a[n/2 -2], a[n-1] -a[(n-1)/2 -2] +2*a[(n-1)/2 -3] -a[(n-1)/2 -4]];
Table[a[n], {n, 0, 100}]
PROG
(Sage)
@CachedFunction
def a(n): # A135564
if (n<8): return [0, 1, 3, -1, -2, -3, 4, 2][n]
elif ((n%2)==0): return a(n-2) - a(n/2) + 2*a(n/2 - 1) - a(n/2 -2)
else: return a(n-1) - a((n-1)/2 - 2) + 2*a((n-1)/2 - 3) - a((n-1)/2 -4)
[a(n) for n in (0..100)] # G. C. Greubel, Nov 26 2021
CROSSREFS
KEYWORD
sign,easy,less
AUTHOR
Roger L. Bagula, Feb 23 2008
EXTENSIONS
Edited by G. C. Greubel, Nov 28 2021
STATUS
approved