login
a(0) = 1; then a(n) = n!*(1 - (-1)^n*Bernoulli(n-1)).
4

%I #13 Sep 08 2022 08:45:30

%S 1,2,3,7,24,116,720,5160,40320,350784,3628800,42940800,479001600,

%T 4650877440,87178291200,2833294464000,20922789888000,

%U -2166903606067200,6402373705728000,6808619561103360000,2432902008176640000,-26982365129174827008000,1124000727777607680000

%N a(0) = 1; then a(n) = n!*(1 - (-1)^n*Bernoulli(n-1)).

%H G. C. Greubel, <a href="/A129724/b129724.txt">Table of n, a(n) for n = 0..300</a>

%p a:= proc(n)

%p if n=0 and n>=0 then 1

%p elif n mod 2 = 0 then n!*(1 - bernoulli(n-1))

%p else n!*(1 + bernoulli(n-1))

%p fi; end;

%p seq(a(n), n=0..25); # modified by _G. C. Greubel_, Dec 03 2019

%t a[0] = 1; a[n_]:= n!*(1-(-1)^n*BernoulliB[n-1]); Table[a[n], {n, 0, 22}] (* _Jean-François Alcover_, Sep 16 2013 *)

%o (PARI) a(n) = if(n==0, 1, n!*(1 - (-1)^n*bernfrac(n-1)) ); \\ _G. C. Greubel_, Dec 03 2019

%o (Magma) [n eq 0 select 1 else Factorial(n)*(1 - (-1)^n*Bernoulli(n-1)): n in [0..25]]; // _G. C. Greubel_, Dec 03 2019

%o (Sage) [1]+[factorial(n)*(1 - (-1)^n*bernoulli(n-1)) for n in (1..25)] # _G. C. Greubel_, Dec 03 2019

%o (GAP) Concatenation([1], List([1..25], n-> Factorial(n)*(1 - (-1)^n*Bernoulli(n-1)) )); # _G. C. Greubel_, Dec 03 2019

%Y Cf. A027641, A027642, A051716, A051717, A129825, A129826.

%K sign

%O 0,2

%A _Paul Curtz_, Jun 02 2007

%E Edited with simpler definition by _N. J. A. Sloane_, May 25 2008