OFFSET
0,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..350
FORMULA
EXAMPLE
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