%I #17 Mar 15 2022 21:43:25
%S 0,1,3,1,5,7,11,13,17,23,1,7,11,13,17,23,29,31,37,41,43,49,53,59,67,
%T 71,73,77,79,83,97,101,107,109,119,121,127,133,137,143,149,151,161,
%U 163,167,169,1,13,17,19,23,29,31,41,47,53,59,61,67,71,73,83,97,101,103,107,121
%N a(n) = prime(n) - primorial(k), where k is the greatest number for which primorial(k) <= prime(n).
%C Conjecture: Each prime number appears in this sequence at least once.
%C Is there any general asymptotic formula for the appearance of prime(n) in this sequence?
%H Michel Marcus, <a href="/A137328/b137328.txt">Table of n, a(n) for n = 1..10000</a>
%e a(6) = prime(6) - primorial(2) = 13 - 6 = 7.
%o (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
%o (Python)
%o from sympy import nextprime
%o from itertools import islice
%o def agen(): # generator of terms
%o pn, primk, pk, pkplus = 2, 2, 2, 3
%o while True:
%o while primk * pkplus <= pn:
%o primk, pk, pkplus = primk*pkplus, pkplus, nextprime(pkplus)
%o yield pn - primk
%o pn = nextprime(pn)
%o print(list(islice(agen(), 67))) # _Michael S. Branicky_, Mar 14 2022
%Y Cf. A000040, A002110, A136437.
%K easy,nonn
%O 1,3
%A _Ctibor O. Zizka_, Apr 07 2008
|