login
A192434
Smallest prime p such that there is a gap of exactly n! between p and the next prime.
0
2, 2, 3, 23, 1669, 1895359, 111113196467011
OFFSET
0,1
COMMENTS
a(7) > 1.5 * 10^18. - Charles R Greathouse IV, Jun 30 2011
a(7) <=
5321252506668526413269161812412779312234715413010708809313699883082142158368298199 (see the Nicely page). - Abhiram R Devesh, Aug 09 2014
LINKS
Thomas R. Nicely, First occurrence prime gaps [For local copy see A000101]
FORMULA
a(n) = A000230(n!/2) for n > 1. - Charles R Greathouse IV, Jun 30 2011
EXAMPLE
a(4) = 1669 because the next prime after 1669 is 1693 and 1693 - 1669 = 24 = 4!
MAPLE
with(numtheory):for n from 0 to 10 do:id:=0:for k from 1 to 2000000 while(id=0) do:p1:=ithprime(k):p2:=ithprime(k+1):if p2-p1 = n! then id:=1: printf(`%d, `, p1): else fi:od:od:
MATHEMATICA
f[n_] := Block[{k = 1}, While[Prime[k + 1] != n + Prime[k], k++ ]; Prime[k]]; Do[ Print[ f[n!]], {n, 0, 10}]
PROG
(PARI) a(n)=my(p=2); n=n!; forprime(q=3, default(primelimit), if(q-p==n, return(p)); p=q) \\ Charles R Greathouse IV, Jun 30 2011
(Python)
import sympy
n=0
while n>=0:
p=2
while sympy.nextprime(p)-p!=(sympy.factorial(n)):
p=sympy.nextprime(p)
print(p)
n=n+1
p=sympy.nextprime(p)
## Abhiram R Devesh, Aug 09 2014
CROSSREFS
Sequence in context: A087768 A113604 A084745 * A189254 A036503 A109590
KEYWORD
nonn,hard
AUTHOR
Michel Lagneau, Jun 30 2011
EXTENSIONS
a(6) from Charles R Greathouse IV, Jun 30 2011
STATUS
approved