login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A135690 a(n) = a(n-2) - (a(n-1) - a(n-2)) if (n mod 2) = 0, otherwise a(n) = a(n-1) - (a(n-3) - a(n-4)), with a(0) = 0, a(1) = 1, a(2) = -1, a(3) = 2. 4
0, 1, -1, 2, -4, -2, -6, 0, -12, -8, -16, -4, -28, -20, -36, -12, -60, -44, -76, -28, -124, -92, -156, -60, -252, -188, -316, -124, -508, -380, -636, -252, -1020, -764, -1276, -508, -2044, -1532, -2556, -1020, -4092, -3068, -5116, -2044, -8188, -6140, -10236, -4092, -16380, -12284, -20476 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
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)
elif (n%2==0): return A135690(n-2) - (A135690(n-1) - A135690(n-2))
else: return A135690(n-1) - (A135690(n-3) - A135690(n-4))
[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
Sequence in context: A198723 A198914 A207868 * A010241 A366839 A278526
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 06:41 EDT 2024. Contains 371782 sequences. (Running on oeis4.)