login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A056889
Numerators of continued fraction for left factorial.
2
0, 1, 1, 0, 1, -1, -2, 1, 2, -1, -3, 2, 9, -7, -40, 33, 224, -191, -1495, 1304, 11545, -10241, -101106, 90865, 989274, -898409, -10690043, 9791634, 126392833, -116601199, -1622625152, 1506023953, 22473758096, -20967734143, -333977722335, 313009988192, 5300202065121, -4987192076929
OFFSET
0,7
LINKS
FORMULA
a(0) = 0; 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).
From Mark van Hoeij, Jul 15 2022: (Start)
a(2*n+1) = -(-1)^n * A058797(n-2).
a(2*n) = (-1)^n * (A058797(n-2) + A058797(n-3)). (End)
MAPLE
a:= proc(n) option remember;
if n<2 then 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, 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, 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 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 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
Sequence in context: A029198 A029175 A186994 * A275761 A232396 A270096
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