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

A135689
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))).
4
0, 1, -1, -2, 1, 2, 2, 1, -1, 1, -2, -1, -2, -5, -1, -2, 1, 1, -1, 0, 2, 4, 1, -1, 2, 5, 5, 4, 1, 2, 2, 5, -1, -5, -1, 0, 1, -2, 0, 0, -2, 0, -4, -5, -1, -3, 1, -1, -2, 1, -5, -3, -5, -8, -4, -7, -1, -1, -2, -1, -2, 1, -5, -6, 1, 1, 5, 2, 1, 7, 0, 4, -1, -5, 2, 1, 0, -1, 0, 3, 2, 0, 0, 0, 4, 6, 5, 3, 1, 5, 3, 4, -1, -5, 1, 3, 2, -2, -1, 1, 5
OFFSET
0,4
LINKS
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
Sequence in context: A279362 A214841 A025917 * A029438 A304274 A081592
KEYWORD
sign,easy,less
AUTHOR
Roger L. Bagula, Feb 19 2008
EXTENSIONS
Edited by N. J. A. Sloane, Mar 03 2008
STATUS
approved