login
A176304
a(n) = (-1)^n * n * a(n-1) - 1, with a(0)=0.
3
0, -1, -3, 8, 31, -156, -937, 6558, 52463, -472168, -4721681, 51938490, 623261879, -8102404428, -113433661993, 1701504929894, 27224078878303, -462809340931152, -8330568136760737, 158280794598454002
OFFSET
0,3
COMMENTS
The sequence alternates in the sign and in the odd-even parity.
LINKS
MAPLE
a(n):=`if`(n=0, 0, (-1)^n*n*a(n-1) -1); seq(a(n), n=0..20); # G. C. Greubel, Nov 26 2019
MATHEMATICA
a[n_]:= a[n] = If[n==0, 0, (-1)^n*n*a[n-1] -1]; Table[a[n], {n, 0, 20}]
PROG
(PARI) a(n) = if(n==0, 0, (-1)^n*n*a(n-1) -1); \\ G. C. Greubel, Nov 26 2019
(Magma)
function a(n)
if n eq 0 then return 0;
else return (-1)^n*n*a(n-1) -1;
end if; return a; end function;
[a(n): n in [0..20]]; // G. C. Greubel, Nov 26 2019
(Sage)
@CachedFunction
def a(n):
if (n==0): return 0
else: return (-1)^n*n*a(n-1) -1
[a(n) for n in (0..20)] # G. C. Greubel, Nov 26 2019
CROSSREFS
Sequence in context: A352624 A108492 A003470 * A368208 A180385 A148903
KEYWORD
sign,easy
AUTHOR
Roger L. Bagula, Apr 14 2010
STATUS
approved