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.
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
Keywords
Examples
a(1) = 2, since prime(1) + 2 + 1 = 5.
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.
Programs
-
Mathematica
Table[Block[{p=2}, While[!PrimeQ[Prime[n] + p + 1], p=NextPrime[p]]; p],{n, 100}] (* Indranil Ghosh, Jun 30 2017 *)
-
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
Extensions
Definition clarified by Chai Wah Wu, Aug 01 2017
More terms from Chai Wah Wu, Aug 02 2017
Comments