OFFSET
0,7
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..351
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
KEYWORD
sign
AUTHOR
Roger L. Bagula, Jan 05 2009
EXTENSIONS
Edited by Robert Israel, Sep 06 2016
STATUS
approved