OFFSET
0,4
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,2,-2).
FORMULA
G.f.: x*(1-2*x)*(1+3*x^2)/((1-x)*(1-2*x^4)). - Colin Barker, Jan 26 2013
a(n) = 4 - C*2^floor(n/4), where C = 4,3,5,2 according as n mod 4 = 0,1,2,3 respectively. - Kevin Ryde, Nov 26 2021
MATHEMATICA
a[0] = 0; a[1] = 1; a[2] = -1; a[3] = 2; a[n_]:= a[n]= If[Mod[n, 2]==0, a[n-2] - (a[n-1] -a[n-2]), a[n-1] -(a[n-3] -a[n-4])]; Table[a[n], {n, 0, 60}]
PROG
(Sage)
@CachedFunction
def A135690(n):
if (n<2): return n
elif (n<4): return (-1)^(n+1)*(n-1)
[A135690(n) for n in (0..60)] # G. C. Greubel, Nov 24 2021
(PARI) a(n) = 4 - [4, 3, 5, 2][n%4+1] << (n>>2); \\ Kevin Ryde, Nov 26 2021
CROSSREFS
KEYWORD
easy,sign,less
AUTHOR
Roger L. Bagula, Feb 19 2008
EXTENSIONS
Edited by G. C. Greubel and Kevin Ryde, Nov 24 2021
STATUS
approved