login
A154232
a(2n) = (n^2-n-1) + a(2n-2), a(2n+1) = (n^2-n-1)*a(2n-1), with a(0)=0 and a(1)=1.
1
0, 1, -1, -1, 0, -1, 5, -5, 16, -55, 35, -1045, 64, -30305, 105, -1242505, 160, -68337775, 231, -4851982025, 320, -431826400225, 429, -47069077624525, 560, -6166049168812775, 715, -955737621165980125, 896, -172988509431042402625
OFFSET
0,7
COMMENTS
Essentially A077415 and A130031 interleaved, see formulas.
LINKS
FORMULA
From Robert Israel, Sep 06 2016: (Start)
a(2*n) = A077415(n) for n >= 2.
a(2*n+1) = cos(Pi*sqrt(5)/2)*Gamma(n+1/2-sqrt(5)/2)*Gamma(n+1/2+sqrt(5)/2)/Pi.
a(2*n+1) = (-1)^n*A130031(n). (End)
MAPLE
a[0]:= 0: a[1]:= 1:
for n from 1 to 49 do
a[2*n]:= (n^2-n-1) +a[2*n-2];
a[2*n+1]:= (n^2-n-1)*a[2*n-1];
od:
seq(a[i], i=0..99); # Robert Israel, Sep 06 2016
MATHEMATICA
(* First program *)
b[n_]:= b[n]= If[n==0, 0, n^2 -n -1 + b[n-1]];
c[n_]:= c[n]= If[n==0, 1, (n^2 -n -1)*c[n-1]];
Flatten[Table[{b[n], c[n]}, {n, 0, 15}]] (* modified by G. C. Greubel, Mar 02 2021 *)
(* Second program *)
a[n_]:= a[n]= If[n<2, n, If[EvenQ[n], ((n^2-2*n-4)/4) + a[n-2], ((n^2-4*n-1)/4)*a[n-2]]];
Table[a[n], {n, 0, 40}] (* G. C. Greubel, Mar 02 2021 *)
PROG
(Sage)
def a(n):
if (n<2): return n
elif (n%2==0): return ((n^2-2*n-4)/4) + a(n-2)
else: return ((n^2-4*n-1)/4)*a(n-2)
[a(n) for n in (0..40)] # G. C. Greubel, Mar 02 2021
(Magma)
function a(n)
if n lt 2 then return n;
elif (n mod 2 eq 0) then return ((n^2-2*n-4)/4) + a(n-2);
else return ((n^2-4*n-1)/4)*a(n-2);
end if; return a;
end function;
[a(n): n in [0..40]]; // G. C. Greubel, Mar 02 2021
CROSSREFS
Sequence in context: A189316 A370236 A356049 * A194615 A195465 A173464
KEYWORD
sign
AUTHOR
Roger L. Bagula, Jan 05 2009
EXTENSIONS
Edited by Robert Israel, Sep 06 2016
STATUS
approved