OFFSET
1,1
COMMENTS
If Maillet's conjecture is true, then a(n) != -1 for all n. - Chai Wah Wu, Aug 01 2017
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
Wen Huang and XiaoSheng Wu, On the set of the difference of primes, Proc. Amer. Math. Soc. 145 (2017), 3787-3793.
E. Maillet, Réponse, L’intermédiaire des math. 12 (1905), p. 108.
EXAMPLE
a(1) = 2, since prime(1) + 2 + 1 = 5.
MATHEMATICA
Table[Block[{p=2}, While[!PrimeQ[Prime[n] + p + 1], p=NextPrime[p]]; p], {n, 100}] (* Indranil Ghosh, Jun 30 2017 *)
PROG
(ANS Forth)
\ https://github.com/Lehs/ANS-Forth-libraries
s" numbertheory.4th" included
: get_number \ p -- q
locals| p | 1
begin nextprime dup p + 1+ isprime
until ;
: list_numbers \ N --
locals| N | 1
begin nextprime dup
get_number cr .
dup N >
until ;
(PARI) a(n) = my(pn=prime(n), p=2); while(! isprime(pn+p+1), p = nextprime(p+1)); p; \\ Michel Marcus, Jun 30 2017
(Python)
from sympy import prime, isprime, nextprime
def a(n):
p=2
while not isprime(prime(n) + p + 1): p=nextprime(p)
return p
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 30 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Lars-Erik Svahn, Jun 21 2017
EXTENSIONS
Definition clarified by Chai Wah Wu, Aug 01 2017
More terms from Chai Wah Wu, Aug 02 2017
STATUS
approved