login
Alternating factorials: n! - (n-1)! + (n-2)! - ... 1!.
(Formerly M3892)
68

%I M3892 #125 Jun 14 2024 01:54:49

%S 0,1,1,5,19,101,619,4421,35899,326981,3301819,36614981,442386619,

%T 5784634181,81393657019,1226280710981,19696509177019,335990918918981,

%U 6066382786809019,115578717622022981,2317323290554617019,48773618881154822981

%N Alternating factorials: n! - (n-1)! + (n-2)! - ... 1!.

%C Conjecture: for n > 2, smallest prime divisor of a(n) > n. - _Gerald McGarvey_, Jun 19 2004

%C Rebuttal: This is not true; see Zivkovic link (Math. Comp. 68 (1999), pp. 403-409) has demonstrated that 3612703 divides a(n) for all n >= 3612702. - Paul Jobling, Oct 18 2004

%C Conjecture: For n>1, a(n) is the number of lattice paths from (0,0) to (n+1,0) that do not cross above y=x or below the x-axis using up-steps +(1,a) and down-steps +(1,-b) where a and b are positive integers. For example, a(3) = 5: [(1,1)(1,1)(1,1)(1,-3)], [(1,1)(1,-1)(1,3)(1,-3)], [(1,1)(1,-1)(1,2)(1,-2)], [(1,1)(1,-1)(1,1)(1,-1)] and [(1,1)(1,1)(1,-1)(1,-1)]. - _Nicholas Ham_, Aug 23 2015

%C Ham's claim is true for n=2. We proceed with a proof for n>2 by induction. On the j-th step, from (j-1,y) to (j,y'), there are j options for y': 0, 1, ..., y-1, y+1, ..., j. Thus there are n! possible paths from (0,0) to x=n that stay between y=0 and y=x. (Then the final step is determined.) However, because +(1,0) is not an allowable step, we cannot land on (n,0) on the n-th step. Therefore, the number of acceptable lattice paths is n! - a(n-1). - _Danny Rorabaugh_, Nov 30 2015

%D Richard K. Guy, Unsolved Problems in Number Theory, 3rd Edition, Springer, 2004, Section B10, pp. 152-153.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H T. D. Noe, <a href="/A005165/b005165.txt">Table of n, a(n) for n = 0..100</a>

%H Richard K. Guy, <a href="/A005169/a005169_6.pdf">Letter to N. J. A. Sloane</a>, Sep 25 1986.

%H Richard K. Guy, <a href="/A005728/a005728.pdf">Letter to N. J. A. Sloane, 1987</a>

%H Richard K. Guy, <a href="http://www.jstor.org/stable/2322249">The strong law of small numbers</a>. Amer. Math. Monthly 95 (1988), no. 8, 697-712.

%H Richard K. Guy, <a href="/A005165/a005165.pdf">The strong law of small numbers</a>. Amer. Math. Monthly 95 (1988), no. 8, 697-712. [Annotated scanned copy]

%H Hisanori Mishima, <a href="http://www.asahi-net.or.jp/~KC2H-MSM/mathland/matha1/matha103.htm">Factorizations of many number sequences: 103</a> and <a href="http://www.asahi-net.or.jp/~KC2H-MSM/mathland/matha1/matha130.htm">130</a>.

%H Alexsandar Petojevic, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL5/Petojevic/petojevic5.html">The Function vM_m(s; a; z) and Some Well-Known Sequences</a>, Journal of Integer Sequences, Vol. 5 (2002), Article 02.1.7.

%H Eric Wegrzynowski, <a href="https://web.archive.org/web/20150912143417/http://www.lifl.fr/~wegrzyno/FormulPrem/FormulesPremiers20.html">Séries de factorielles</a>.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/AlternatingFactorial.html">Alternating Factorial</a> and <a href="http://mathworld.wolfram.com/Factorial.html">Factorial</a>.

%H Miodrag Živković, <a href="http://dx.doi.org/10.1090/S0025-5718-99-00990-4">The number of primes Sum_{i=1..n} (-1)^(n-i)*i! is finite</a>, Math. Comp. 68 (1999), pp. 403-409.

%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>.

%F a(0) = 0, a(n) = n! - a(n-1) for n > 0; also a(n) = n*a(n-2) + (n-1)*a(n-1) for n > 1. Sum_{n>=1} Pi^n/a(n) ~ 30.00005. - _Gerald McGarvey_, Jun 19 2004

%F E.g.f.: 1/(1-x) + exp(-x)*(e*(Ei(1,1)-Ei(1,1-x)) - 1). - _Robert Israel_, Dec 01 2015

%F a(n) = (-1)^n*(exp(1)*(gamma(n+2)*gamma(-1-n,1)*(-1)^n +Ei(1))-1). - _Gerry Martens_, May 22 2018

%F Sum_{n>=1} 1/a(n) = A343187. - _Amiram Eldar_, Jun 01 2023

%p A005165 := proc(n) local i; add((-1)^(n-i)*i!,i=1..n); end;

%t 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 *)

%t a[0] = 0; a[n_] := n! - a[n - 1]; Array[a, 26, 0] (* _Robert G. Wilson v_, Aug 06 2012 *)

%t RecurrenceTable[{a[n] == n! - a[n - 1], a[0] == 0}, a, {n, 0, 20}] (* _Eric W. Weisstein_, Jul 27 2017 *)

%t AlternatingFactorial[Range[0, 20]] (* _Eric W. Weisstein_, Jul 27 2017 *)

%t a[n_] = (-1)^n (Exp[1]((-1)^n Gamma[-1-n,1] Gamma[2+n] - ExpIntegralEi[-1]) - 1)

%t Table[a[n] // FullSimplify, {n, 0, 20}] (* _Gerry Martens_, May 22 2018 *)

%o (PARI) a(n)=if(n<0,0,sum(k=0,n-1,(-1)^k*(n-k)!))

%o (Python)

%o a = 0

%o f = 1

%o for n in range(1, 33):

%o print(a, end=",")

%o f *= n

%o a = f - a

%o # _Alex Ratushnyak_, Aug 05 2012

%o (PARI) first(m)=vector(m,j,sum(i=0,j-1,((-1)^i)*(j-i)!)) \\ _Anders Hellström_, Aug 23 2015

%o (PARI) a(n)=round((-1)^n*(exp(1)*(gamma(n+2)*incgam(-1-n,1)*(-1)^n +eint1(1))-1)) \\ _Gerry Martens_, May 22 2018

%o (Haskell)

%o a005165 n = a005165_list !! n

%o a005165_list = 0 : zipWith (-) (tail a000142_list) a005165_list

%o -- _Reinhard Zumkeller_, Jul 21 2013

%o (GAP) List([0..30],n->Sum([1..n],i->(-1)^(n-i)*Factorial(i))); # _Muniru A Asiru_, Jun 01 2018

%Y Cf. A000142, A001272, A003422, A071828, A303697, A343187, A359808.

%K nonn,easy,nice

%O 0,4

%A _N. J. A. Sloane_