login
A038710
a(n) is the smallest prime > product of the first n primes (A002110(n)).
9
2, 3, 7, 31, 211, 2311, 30047, 510529, 9699713, 223092907, 6469693291, 200560490131, 7420738134871, 304250263527281, 13082761331670077, 614889782588491517, 32589158477190044789, 1922760350154212639131, 117288381359406970983379, 7858321551080267055879179
OFFSET
0,1
LINKS
FORMULA
a(n) = A002110(n) + A038711(n). - Alois P. Heinz, Mar 16 2020
EXAMPLE
for n=1,2,3,4,5,11,75, A002110(n)+1 gives smaller primes than A002110(n)+p, where p is a fortunate number (prime). At n=5, both 2311 and 2333 are primes but the first is smaller.
MAPLE
p:= proc(n) option remember; `if`(n<1, 1, p(n-1)*ithprime(n)) end:
a:= n-> nextprime(p(n)):
seq(a(n), n=0..20); # Alois P. Heinz, Mar 16 2020
MATHEMATICA
nmax = 2^16384; npd = 1; n = 1; npd = npd*Prime[n]; While[npd < nmax, cp = npd + 1; While[ ! (PrimeQ[cp]), cp = cp + 2]; Print[cp]; n = n + 1; npd = npd*Prime[n]] (* Lei Zhou, Feb 15 2005 *)
NextPrime/@FoldList[Times, 1, Prime[Range[25]]] (* Harvey P. Dale, Dec 17 2010 *)
PROG
(PARI) a(n) = nextprime(1+factorback(primes(n))); \\ Michel Marcus, Sep 25 2016; Dec 24 2022
(Python)
from sympy import nextprime, primorial
def a(n): return nextprime(primorial(n) if n else 1)
print([a(n) for n in range(20)]) # Michael S. Branicky, Dec 24 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, May 02 2000
EXTENSIONS
Offset corrected, incorrect comment and formula removed, and more terms added by Jinyuan Wang, Mar 16 2020
STATUS
approved