A005165
Alternating factorials: n! - (n-1)! + (n-2)! - ... 1!.
Original entry on oeis.org
0, 1, 1, 5, 19, 101, 619, 4421, 35899, 326981, 3301819, 36614981, 442386619, 5784634181, 81393657019, 1226280710981, 19696509177019, 335990918918981, 6066382786809019, 115578717622022981, 2317323290554617019, 48773618881154822981
Offset: 0
- Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section B10, pp. 152-153.
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
- T. D. Noe, Table of n, a(n) for n = 0..100
- Richard K. Guy, Letter to N. J. A. Sloane, Sep 25 1986.
- Richard K. Guy, Letter to N. J. A. Sloane, 1987
- Richard K. Guy, The strong law of small numbers. Amer. Math. Monthly 95 (1988), no. 8, 697-712.
- Richard K. Guy, The strong law of small numbers. Amer. Math. Monthly 95 (1988), no. 8, 697-712. [Annotated scanned copy]
- Hisanori Mishima, Factorizations of many number sequences: 103 and 130.
- Alexsandar Petojevic, The Function vM_m(s; a; z) and Some Well-Known Sequences, Journal of Integer Sequences, Vol. 5 (2002), Article 02.1.7.
- Eric Wegrzynowski, Séries de factorielles.
- Eric Weisstein's World of Mathematics, Alternating Factorial and Factorial.
- Miodrag Živković, The number of primes Sum_{i=1..n} (-1)^(n-i)*i! is finite, Math. Comp. 68 (1999), pp. 403-409.
- Index entries for sequences related to factorial numbers.
-
List([0..30],n->Sum([1..n],i->(-1)^(n-i)*Factorial(i))); # Muniru A Asiru, Jun 01 2018
-
a005165 n = a005165_list !! n
a005165_list = 0 : zipWith (-) (tail a000142_list) a005165_list
-- Reinhard Zumkeller, Jul 21 2013
-
A005165 := proc(n) local i; add((-1)^(n-i)*i!,i=1..n); end;
-
nn=25;With[{fctrls=Range[nn]!},Table[Abs[Total[Times@@@Partition[ Riffle[ Take[ fctrls,n],{1,-1}],2]]],{n,nn}]] (* Harvey P. Dale, Dec 10 2011 *)
a[0] = 0; a[n_] := n! - a[n - 1]; Array[a, 26, 0] (* Robert G. Wilson v, Aug 06 2012 *)
RecurrenceTable[{a[n] == n! - a[n - 1], a[0] == 0}, a, {n, 0, 20}] (* Eric W. Weisstein, Jul 27 2017 *)
AlternatingFactorial[Range[0, 20]] (* Eric W. Weisstein, Jul 27 2017 *)
a[n_] = (-1)^n (Exp[1]((-1)^n Gamma[-1-n,1] Gamma[2+n] - ExpIntegralEi[-1]) - 1)
Table[a[n] // FullSimplify, {n, 0, 20}] (* Gerry Martens, May 22 2018 *)
-
a(n)=if(n<0,0,sum(k=0,n-1,(-1)^k*(n-k)!))
-
first(m)=vector(m,j,sum(i=0,j-1,((-1)^i)*(j-i)!)) \\ Anders Hellström, Aug 23 2015
-
a(n)=round((-1)^n*(exp(1)*(gamma(n+2)*incgam(-1-n,1)*(-1)^n +eint1(1))-1)) \\ Gerry Martens, May 22 2018
-
a = 0
f = 1
for n in range(1, 33):
print(a, end=",")
f *= n
a = f - a
# Alex Ratushnyak, Aug 05 2012
A153229
a(0) = 0, a(1) = 1, and for n >= 2, a(n) = (n-1) * a(n-2) + (n-2) * a(n-1).
Original entry on oeis.org
0, 1, 0, 2, 4, 20, 100, 620, 4420, 35900, 326980, 3301820, 36614980, 442386620, 5784634180, 81393657020, 1226280710980, 19696509177020, 335990918918980, 6066382786809020, 115578717622022980, 2317323290554617020, 48773618881154822980, 1075227108896452857020
Offset: 0
Shaojun Ying (dolphinysj(AT)gmail.com), Dec 21 2008
a(20) = 19 * a(18) + 18 * a(19) = 19 * 335990918918980 + 18 * 6066382786809020 = 6383827459460620 + 109194890162562360 = 115578717622022980
-
unsigned long a(unsigned int n) {
if (n == 0) return 0;
if (n == 1) return 1;
return (n - 1) * a(n - 2) + (n - 2) * a(n - 1); }
-
t1 := sum(n!*x^n, n=0..100): F := series(t1/(1+x), x, 100): for i from 0 to 40 do printf(`%d, `, i!-coeff(F, x, i)) od: # Zerinvary Lajos, Mar 22 2009
# second Maple program:
a:= proc(n) a(n):= `if`(n<2, n, (n-1)*a(n-2) +(n-2)*a(n-1)) end:
seq(a(n), n=0..25); # Alois P. Heinz, May 24 2013
-
Join[{a = 0}, Table[b = n! - a; a = b, {n, 0, 100}]] (* Vladimir Joseph Stephan Orlovsky, Jun 28 2011 *)
RecurrenceTable[{a[0]==0,a[1]==1,a[n]==(n-1)a[n-2]+(n-2)a[n-1]},a,{n,30}] (* Harvey P. Dale, May 01 2020 *)
-
a(n)=if(n,my(t=(-1)^n);-t-sum(i=1,n-1,t*=-i),0); \\ Charles R Greathouse IV, Jun 28 2011
A321316
Number T(n,k) of permutations of [n] whose difference between the length of the longest increasing subsequence and the length of the longest decreasing subsequence equals k; triangle T(n,k), n >= 1, 1-n <= k <= n-1, read by rows.
Original entry on oeis.org
1, 1, 0, 1, 1, 0, 4, 0, 1, 1, 0, 9, 4, 9, 0, 1, 1, 0, 16, 25, 36, 25, 16, 0, 1, 1, 0, 25, 81, 125, 256, 125, 81, 25, 0, 1, 1, 0, 36, 196, 421, 1225, 1282, 1225, 421, 196, 36, 0, 1, 1, 0, 49, 400, 1225, 4292, 9261, 9864, 9261, 4292, 1225, 400, 49, 0, 1
Offset: 1
: 1 ;
: 1, 0, 1 ;
: 1, 0, 4, 0, 1 ;
: 1, 0, 9, 4, 9, 0, 1 ;
: 1, 0, 16, 25, 36, 25, 16, 0, 1 ;
: 1, 0, 25, 81, 125, 256, 125, 81, 25, 0, 1 ;
: 1, 0, 36, 196, 421, 1225, 1282, 1225, 421, 196, 36, 0, 1 ;
-
h:= l-> (n-> add(i, i=l)!/mul(mul(1+l[i]-j+add(`if`(j>
l[k], 0, 1), k=i+1..n), j=1..l[i]), i=1..n))(nops(l)):
f:= l-> h(l)^2*x^(l[1]-nops(l)) :
g:= (n, i, l)-> `if`(n=0 or i=1, f([l[], 1$n]),
g(n, i-1, l) +g(n-i, min(i, n-i), [l[], i])):
b:= proc(n) option remember; g(n$2, []) end:
T:= (n, k)-> coeff(b(n), x, k):
seq(seq(T(n, k), k=1-n..n-1), n=1..10);
-
h[l_] := With[{n = Length[l]}, Total[l]!/Product[Product[1 + l[[i]] - j + Sum[If[j > l[[k]], 0, 1], {k, i + 1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
f[l_] := h[l]^2*x^(l[[1]] - Length[l]);
g[n_, i_, l_] := If[n == 0 || i == 1, f[Join[l, Table[1, {n}]]], g[n, i - 1, l] + g[n - i, Min[i, n - i], Append[l, i]]];
b[n_] := b[n] = g[n, n, {}];
T[n_, k_] := Coefficient[b[n], x, k];
Table[Table[T[n, k], {k, 1 - n, n - 1}], {n, 1, 10}] // Flatten (* Jean-François Alcover, Feb 27 2021, after Alois P. Heinz *)
A316292
Number T(n,k) of permutations p of [n] such that k is the maximum of the partial sums of the signed up-down jump sequence of 0,p; triangle T(n,k), n>=0, ceiling((sqrt(1+8*n)-1)/2)<=k<=n, read by rows.
Original entry on oeis.org
1, 1, 2, 1, 5, 8, 16, 5, 50, 65, 1, 79, 314, 326, 69, 872, 2142, 1957, 34, 1539, 8799, 16248, 13700, 9, 1823, 24818, 89273, 137356, 109601, 1, 1494, 50561, 355271, 947713, 1287350, 986410, 856, 76944, 1070455, 4923428, 10699558, 13281458, 9864101
Offset: 0
Triangle T(n,k) begins:
: 1;
: 1;
: 2;
: 1, 5;
: 8, 16;
: 5, 50, 65;
: 1, 79, 314, 326;
: 69, 872, 2142, 1957;
: 34, 1539, 8799, 16248, 13700;
: 9, 1823, 24818, 89273, 137356, 109601;
: 1, 1494, 50561, 355271, 947713, 1287350, 986410;
-
b:= proc(u, o, c, k) option remember;
`if`(c>k, 0, `if`(u+o=0, 1,
add(b(u-j, o-1+j, c+j, k), j=1..u)+
add(b(u+j-1, o-j, c-j, k), j=1..o)))
end:
T:= (n, k)-> b(n, 0$2, k) -`if`(k=0, 0, b(n, 0$2, k-1)):
seq(seq(T(n, k), k=ceil((sqrt(1+8*n)-1)/2)..n), n=0..14);
-
b[u_, o_, c_, k_] := b[u, o, c, k] =
If[c > k, 0, If[u + o == 0, 1,
Sum[b[u - j, o - 1 + j, c + j, k], {j, 1, u}] +
Sum[b[u + j - 1, o - j, c - j, k], {j, 1, o}]]];
T[n_, k_] := b[n, 0, 0, k] - If[k == 0, 0, b[n, 0, 0, k - 1]];
Table[Table[T[n, k], {k, Ceiling[(Sqrt[8n+1]-1)/2], n}], {n, 0, 14}] // Flatten (* Jean-François Alcover, Feb 27 2021, after Alois P. Heinz *)
A316293
Number T(n,k) of permutations p of [n] such that k is the maximum of the partial sums of the signed up-down jump sequence of 0,p; triangle T(n,k), k>=0, k<=n<=k*(k+1)/2, read by columns.
Original entry on oeis.org
1, 1, 2, 1, 5, 8, 5, 1, 16, 50, 79, 69, 34, 9, 1, 65, 314, 872, 1539, 1823, 1494, 856, 339, 89, 14, 1, 326, 2142, 8799, 24818, 50561, 76944, 89546, 80938, 57284, 31771, 13707, 4520, 1103, 188, 20, 1, 1957, 16248, 89273, 355271, 1070455, 2514044, 4705648
Offset: 0
Triangle T(n,k) begins:
: 1;
: 1;
: 2;
: 1, 5;
: 8, 16;
: 5, 50, 65;
: 1, 79, 314, 326;
: 69, 872, 2142, 1957;
: 34, 1539, 8799, 16248, 13700;
: 9, 1823, 24818, 89273, 137356, 109601;
: 1, 1494, 50561, 355271, 947713, 1287350, 986410;
-
b:= proc(u, o, c, k) option remember;
`if`(c>k, 0, `if`(u+o=0, 1,
add(b(u-j, o-1+j, c+j, k), j=1..u)+
add(b(u+j-1, o-j, c-j, k), j=1..o)))
end:
T:= (n, k)-> b(n, 0$2, k) -`if`(k=0, 0, b(n, 0$2, k-1)):
seq(seq(T(n, k), n=k..k*(k+1)/2), k=0..8);
-
b[u_, o_, c_, k_] := b[u, o, c, k] = If[c > k, 0, If[u + o == 0, 1,
Sum[b[u - j, o - 1 + j, c + j, k], {j, 1, u}] +
Sum[b[u + j - 1, o - j, c - j, k], {j, 1, o}]]];
T[n_, k_] := b[n, 0, 0, k] - If[k == 0, 0, b[n, 0, 0, k - 1]];
Table[Table[T[n, k], {n, k, k(k+1)/2}], {k, 0, 8}] // Flatten (* Jean-François Alcover, Mar 14 2021, after Alois P. Heinz *)
Showing 1-5 of 5 results.
Comments