OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Kevin Ryde, PARI/GP Code and Notes
FORMULA
a(n) = a(n-2) - 2*( a(floor(n/2)) - a(abs(floor(n/2) - 1)) ) if (n mod 2) = 0, otherwise a(n-1) - 2*( a(abs(floor(n/2) - 2)) - a(abs(floor(n/2) - 3)) ), with a(0) = 0, a(1) = 1, a(2) = -2, a(3) = -4.
MATHEMATICA
a[n_]:= a[n]= If[n<2, n, If[n<4, -2^(n-1), If[Mod[n, 2]==0, a[n-2] - 2*( a[Floor[n/2]] - a[Abs[Floor[n/2] -1]]), a[n-1] - 2*(a[Abs[Floor[n/2] -2]] - a[Abs[Floor[n/2] -3]]) ]]];
Table[a[n], {n, 0, 80}]
PROG
(Sage)
@CachedFunction
def A135692(n):
if (n<2): return n
elif (n<4): return -2^(n-1)
[A135692(n) for n in (0..80)] # G. C. Greubel, Nov 24 2021
(PARI) See links.
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Roger L. Bagula, Feb 21 2008
EXTENSIONS
Edited by G. C. Greubel, Nov 24 2021
STATUS
approved