[go: up one dir, main page]

login
A056890
Denominators of continued fraction for left factorial.
2
1, -1, 0, -1, -2, 1, 1, 0, 1, -1, -4, 3, 14, -11, -63, 52, 353, -301, -2356, 2055, 18194, -16139, -159335, 143196, 1559017, -1415821, -16846656, 15430835, 199185034, -183754199, -2557127951, 2373373752, 35416852081, -33043478329, -526322279512, 493278801183, 8352696141782
OFFSET
0,5
LINKS
FORMULA
a(0)=1; a(1)=-1; a(2*n)=n*a(2*n-1)+a(2*n-2); a(2*n+1)= - a(2*n)+a(2*n-1)
MAPLE
a:= proc(n) option remember;
if n<2 then (-1)^n
elif (n mod 2)=0 then (n/2)*a(n-1) +a(n-2)
else -a(n-1) +a(n-2)
fi; end:
seq(a(n), n=0..40); # G. C. Greubel, Dec 05 2019
MATHEMATICA
a[n_]:= a[n]= If[n<2, (-1)^n, If[EvenQ[n], (n/2)*a[n-1] +a[n-2], -a[n-1] +a[n-2]]]; Table[a[n], {n, 0, 40}] (* G. C. Greubel, Dec 05 2019 *)
PROG
(PARI) a(n) = if(n<2, (-1)^n, if(Mod(n, 2)==0, (n/2)*a(n-1) +a(n-2), -a(n-1) +a(n-2) )); \\ G. C. Greubel, Dec 05 2019
(Sage)
@CachedFunction
def a(n):
if (n<2): return (-1)^n
elif (mod(n, 2) ==0): return (n/2)*a(n-1) +a(n-2)
else: return -a(n-1) +a(n-2)
[a(n) for n in (0..40)] # G. C. Greubel, Dec 05 2019
(GAP)
a:= function(n)
if n<2 then return (-1)^n;
elif (n mod 2)=0 then return (n/2)*a(n-1) +a(n-2);
else return -a(n-1) +a(n-2);
fi; end;
List([0..20], n-> a(n) ); # G. C. Greubel, Dec 05 2019
CROSSREFS
Cf. A056889.
Sequence in context: A294446 A318163 A114640 * A321519 A346392 A169590
KEYWORD
sign,frac,easy
AUTHOR
EXTENSIONS
More terms from James A. Sellers, Sep 06 2000 and from Larry Reeves (larryr(AT)acm.org), Sep 07 2000
STATUS
approved