login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A087421 Smallest prime >= n!. 3

%I #29 May 29 2024 19:55:52

%S 2,2,2,7,29,127,727,5051,40343,362897,3628811,39916801,479001629,

%T 6227020867,87178291219,1307674368043,20922789888023,355687428096031,

%U 6402373705728037,121645100408832089,2432902008176640029,51090942171709440031,1124000727777607680031

%N Smallest prime >= n!.

%C n! is prime only when n=2. When n>2, for n!+m to be prime, m must be relatively prime to all the numbers from 2 to n. In particular, if m is between 2 and n, then (n!+m) will be divisible by m. Thus a(n) must be either n!+1, or else larger than n!+n.

%H Hugo Pfoertner, <a href="/A087421/b087421.txt">Table of n, a(n) for n = 0..400</a>

%H Antonín Čejchan, Michal Křížek, and Lawrence Somer, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL25/Krizek/krizek3.html">On Remarkable Properties of Primes Near Factorials and Primorials</a>, Journal of Integer Sequences, Vol. 25 (2022), Article 22.1.4.

%F a(n) = min { p[i] | p[i]>=n! }, where p[i] is the set of prime numbers.

%F a(n) = A007918(A000142(n)). - _Michel Marcus_, Apr 09 2018

%e a(0) = 2 since 0! = 1 and 2 is the smallest prime >= 1.

%e a(4) = 29 since 4! = 24 and 29 is the smallest prime >= 24.

%t NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; Table[ NextPrim[n! - 1], {n, 0, 20}] (* _Robert G. Wilson v_, Oct 25 2003 *)

%t Join[{2,2,2},NextPrime[Range[3,25]!]] (* _Harvey P. Dale_, Feb 23 2011 *)

%o (PARI) a(n)=nextprime(n!); \\ _R. J. Cano_, Apr 08 2018

%o (Python)

%o from sympy import factorial, nextprime

%o def a(n): return nextprime(factorial(n)-1)

%o print([a(n) for n in range(23)]) # _Michael S. Branicky_, May 22 2022

%Y Cf. A000142, A006990, A007918, A033932, A037151.

%K nonn

%O 0,1

%A Mitch Cervinka (puritan(AT)planetkc.com), Oct 22 2003

%E Edited, corrected and extended by _Robert G. Wilson v_ and _Ray Chandler_, Oct 25 2003

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 16 12:46 EDT 2024. Contains 375174 sequences. (Running on oeis4.)