This site is supported by donations to The OEIS Foundation.



Many excellent designs for a new banner were submitted. We will use the best of them in rotation.

(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A001272 Numbers n such that n! - (n-1)! + (n-2)! - (n-3)! + ... - (-1)^n*1! is prime. 5
3, 4, 5, 6, 7, 8, 10, 15, 19, 41, 59, 61, 105, 160, 661, 2653, 3069, 3943, 4053, 4998, 8275, 9158, 11164 (list; graph; refs; listen; history; text; internal format)



At present the terms >= 2653 are only probable primes.

Zivkovic shows that all terms must be less than p=3612703, which divides a(n) for n>=p. - T. D. Noe, Jan 25 2008

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


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

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

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

M. Zivkovic, The number of primes Sum_{i=1..n} (-1)^(n-i)*i! is finite. Math. Comp. 68 (1999), no. 225, 403-409.


Table of n, a(n) for n=1..23.

R. Ondrejka, The Top Ten: a Catalogue of Primal Configurations

factordb.com, Primality at factor-database of the alternating factorial for n=661

Eric Weisstein's World of Mathematics, Alternating Factorial

Eric Weisstein's World of Mathematics, Factorial Sums

Eric Weisstein's World of Mathematics, Integer Sequence Primes

Index entries for sequences related to factorial numbers


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


(* 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, 1, n}]], Print[n]; Sow[n]]]][[2, 1]] (* Jean-Fran├žois Alcover, Sep 05 2013 *)


Cf. A005165, A002981, A002982, A100289.

Sequence in context: A066378 A125684 A207669 * A047563 A120561 A051016

Adjacent sequences:  A001269 A001270 A001271 * A001273 A001274 A001275




N. J. A. Sloane.


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).

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

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

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

a(23)=11164 found by Paul Jobling on Nov 25 2004.

Edited by T. D. Noe, Oct 30 2008

Edited by Hans Havermann, Jun 17 2013



Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified April 20 09:30 EDT 2014. Contains 240779 sequences.