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!)
A135692 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. 4

%I #33 Dec 12 2021 02:24:11

%S 0,1,-2,-4,4,6,8,6,-8,-2,-12,-8,-16,-32,-12,-16,16,12,4,8,24,52,16,4,

%T 32,52,64,56,24,40,32,64,-32,-72,-24,-16,-8,-72,-16,-8,-48,-32,-104,

%U -112,-32,-64,-8,-64,-64,8,-104,-80,-128,-184,-112,-152,-48,-72,-80,-64,-64,0,-128,-160,64,80,144,80,48,240,32,112,16,-80

%N 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.

%H G. C. Greubel, <a href="/A135692/b135692.txt">Table of n, a(n) for n = 0..1000</a>

%H Kevin Ryde, <a href="/A135692/a135692.gp.txt">PARI/GP Code and Notes</a>

%F 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.

%t 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]]) ]]];

%t Table[a[n], {n, 0, 80}]

%o (Sage)

%o @CachedFunction

%o def A135692(n):

%o if (n<2): return n

%o elif (n<4): return -2^(n-1)

%o elif (n%2==0): return A135692(n-2) - 2*(A135692(n//2) - A135692(abs(n//2 -1)))

%o else: return A135692(n-1) - 2*(A135692(abs(n//2 -2)) - A135692(abs(n//2 -3)))

%o [A135692(n) for n in (0..80)] # _G. C. Greubel_, Nov 24 2021

%o (PARI) See links.

%Y Cf. A135689, A135690.

%K sign,easy

%O 0,3

%A _Roger L. Bagula_, Feb 21 2008

%E Edited by _G. C. Greubel_, Nov 24 2021

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 16 16:47 EDT 2024. Contains 371749 sequences. (Running on oeis4.)