OFFSET
1,3
COMMENTS
Conjecture: Each prime number appears in this sequence at least once.
Is there any general asymptotic formula for the appearance of prime(n) in this sequence?
LINKS
Michel Marcus, Table of n, a(n) for n = 1..10000
EXAMPLE
a(6) = prime(6) - primorial(2) = 13 - 6 = 7.
PROG
(PARI) a(n) = {my(p=prime(n), q=1, P=1); until (P > p, q = nextprime(q+1); P *= q; ); p - P/q; } \\ Michel Marcus, Mar 14 2022
(Python)
from sympy import nextprime
from itertools import islice
def agen(): # generator of terms
pn, primk, pk, pkplus = 2, 2, 2, 3
while True:
while primk * pkplus <= pn:
primk, pk, pkplus = primk*pkplus, pkplus, nextprime(pkplus)
yield pn - primk
pn = nextprime(pn)
print(list(islice(agen(), 67))) # Michael S. Branicky, Mar 14 2022
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Ctibor O. Zizka, Apr 07 2008
STATUS
approved