OFFSET
0,4
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
FORMULA
a(n) = a(n-2) - (a(floor(n/2)) - a(abs(floor(n/2) - 1))) if (n mod 2 = 0), otherwise a(n-1) - (a(abs(floor(n/2) - 2)) - a(abs(floor(n/2) - 3))).
MATHEMATICA
a[n_]:= a[n] = If[n<2, n, If[n<4, 1-n, If[Mod[n, 2]==0, a[n-2] - (a[Floor[n/2]] - a[Abs[Floor[n/2] -1]]), a[n-1] - (a[Abs[Floor[n/2] -2]] - a[Abs[Floor[n/2] - 3]])] ]]; Table[a[n], {n, 0, 110}]
PROG
(Sage)
def a(n): # A135689
if (n<4): return [0, 1, -1, -2][n]
elif ((n%2)==0): return a(n-2) - (a((n//2)) - a(abs((n//2) - 1)))
else: return a(n-1) - (a(abs((n//2) - 2)) - a(abs((n//2) - 3)))
[a(n) for n in (0..110)] # G. C. Greubel, Nov 26 2021
CROSSREFS
KEYWORD
sign,easy,less
AUTHOR
Roger L. Bagula, Feb 19 2008
EXTENSIONS
Edited by N. J. A. Sloane, Mar 03 2008
STATUS
approved