login
A179295
a(n) is the least prime number such that prime(n)+a(n)+1 is a prime or -1 if no such prime number exists.
1
2, 3, 5, 3, 5, 3, 5, 3, 5, 7, 5, 3, 5, 3, 5, 5, 7, 5, 3, 7, 5, 3, 5, 7, 3, 5, 3, 5, 3, 13, 3, 5, 11, 11, 7, 5, 5, 3, 5, 5, 11, 11, 5, 3, 13, 11, 11, 3, 5, 3, 5, 11, 29, 5, 5, 5, 7, 5, 3, 11, 23, 13, 3, 5, 3, 13, 5, 11, 5, 3, 5, 7, 5, 5, 3, 5, 7, 3, 7, 11, 11
OFFSET
1,1
COMMENTS
If Maillet's conjecture is true, then a(n) != -1 for all n. - Chai Wah Wu, Aug 01 2017
LINKS
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
Sequence in context: A201769 A077276 A073684 * A083776 A122820 A261324
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