login
Numbers k such that k! - (k-1)! + (k-2)! - (k-3)! + ... - (-1)^k*1! is prime.
10

%I #71 Feb 16 2025 08:32:23

%S 3,4,5,6,7,8,10,15,19,41,59,61,105,160,661,2653,3069,3943,4053,4998,

%T 8275,9158,11164,43592,59961

%N Numbers k such that k! - (k-1)! + (k-2)! - (k-3)! + ... - (-1)^k*1! is prime.

%C At present the terms greater than or equal to 2653 are only probable primes.

%C Živković shows that all terms must be less than p = 3612703, which divides the alternating factorial af(k) for k >= p. - _T. D. Noe_, Jan 25 2008

%C Notwithstanding Živković's wording, p = 3612703 also divides the alternating factorial for k = 3612702. [Guy: If there is a value of k such that k + 1 divides af(k), then k + 1 will divide af(m) for all m > k.] Therefore af(3612701), approximately 7.3 * 10^22122513, is the final primality candidate. - _Hans Havermann_, Jun 17 2013

%C Next term (if it exists) has k > 100000 (per M. Rodenkirch post). - _Eric W. Weisstein_, Dec 18 2017

%D J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 160, p. 52, Ellipses, Paris 2008.

%D Martin Gardner, Strong Laws of Small Primes, in The Last Recreations, p. 198 (1997).

%D R. K. Guy, Unsolved Problems in Number Theory, B43.

%D David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 97.

%H factordb.com, <a href="http://factordb.com/index.php?id=1100000000613263128">Primality at factor-database of the alternating factorial for n=661</a>.

%H Rudolf Ondrejka, <a href="http://www.utm.edu/research/primes/lists/top_ten/">The Top Ten: a Catalogue of Primal Configurations</a>.

%H M. Rodenkirch, <a href="http://www.mersenneforum.org/showthread.php?p=474083#post474083">Alternating Factorials</a>.

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

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/FactorialSums.html">Factorial Sums</a>.

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/IntegerSequencePrimes.html">Integer Sequence Primes</a>.

%H Miodrag Živković, <a href="https://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), no. 225, 403-409.

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

%p with(numtheory); f := proc(n) local i; add((-1)^(n-i)*i!,i=1..n); end; isprime(f(15));

%t (* This program is not convenient for more than 15 terms *) Reap[For[n = 1, n <= 1000, n++, If[PrimeQ[Sum[(-1)^(n - k) * k!, {k, n}]], Print[n]; Sow[n]]]][[2, 1]] (* _Jean-François Alcover_, Sep 05 2013 *)

%t Position[AlternatingFactorial[Range[200]], _?PrimeQ] // Flatten (* _Eric W. Weisstein_, Sep 19 2017 *)

%Y Cf. A005165, A002981, A002982, A100289.

%K nonn,hard,more,nice,fini

%O 1,1

%A _N. J. A. Sloane_

%E 661 found independently by _Eric W. Weisstein_ and Rachel Lewis (racheljlewis(AT)hotmail.com); 2653 and 3069 found independently by Chris Nash (nashc(AT)lexmark.com) and Rachel Lewis (racheljlewis(AT)hotmail.com)

%E 3943, 4053, 4998 found by Paul Jobling (paul.jobling(AT)whitecross.com)

%E 8275, 9158 found by team of Rachel Lewis, Paul Jobling and Chris Nash

%E 661! - 660! + 659! - ... was shown to be prime by team of Giovanni La Barbera and others using the Certifix program developed by Marcel Martin, Jul 15 2000 (see link) - Paul Jobling (Paul.Jobling(AT)WhiteCross.com) and Giovanni La Barbera, Aug 02 2000

%E a(23) = 11164 found by Paul Jobling, Nov 25 2004

%E Edited by _T. D. Noe_, Oct 30 2008

%E Edited by _Hans Havermann_, Jun 17 2013

%E a(24) = 43592 from _Serge Batalov_, Jul 19 2017

%E a(25) = 59961 from _Mark Rodenkirch_, Sep 18 2017