login
A266224
Least x such that prime(n)*x+x+1 is a prime, or -1 if no such x exists.
1
2, 1, 1, 2, 1, 2, 1, 2, 3, 1, 3, 5, 1, 2, 2, 2, 1, 5, 2, 1, 2, 3, 4, 2, 2, 1, 3, 1, 3, 2, 2, 3, 1, 2, 1, 3, 2, 5, 2, 2, 1, 3, 1, 2, 1, 2, 5, 2, 1, 2, 4, 1, 3, 3, 4, 5, 1, 5, 2, 1, 2, 3, 2, 1, 5, 10, 3, 2, 1, 2, 2, 5, 9, 3, 2, 2, 3, 2, 4, 2, 1, 5, 1, 3, 2, 4, 4
OFFSET
1,1
COMMENTS
Conjecture: a(n) > 0.
EXAMPLE
5*1+1+1=7 is a prime, therefore a(3)=1.
7*1+1+1=9 is not a prime, but 7*2+2+1=17 is a prime, so a(4)=2.
PROG
(Python)
from sympy import isprime
TOP=1000000
for p in range(2, 777):
if isprime(p):
failed = True
for x in range(1, TOP):
if isprime(p*x+x+1):
print str(x)+', ',
failed = False
break
if failed: print '-1, ',
(PARI) a(n) = {x = 1; while (!isprime(prime(n)*x+x+1), x++); x; } \\ Michel Marcus, Dec 27 2015
CROSSREFS
Sequence in context: A321944 A065203 A230798 * A029396 A084746 A128259
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Dec 24 2015
STATUS
approved