%I #9 Jan 09 2016 14:14:14
%S 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,
%T 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,
%U 1,2,2,5,9,3,2,2,3,2,4,2,1,5,1,3,2,4,4
%N Least x such that prime(n)*x+x+1 is a prime, or -1 if no such x exists.
%C Conjecture: a(n) > 0.
%e 5*1+1+1=7 is a prime, therefore a(3)=1.
%e 7*1+1+1=9 is not a prime, but 7*2+2+1=17 is a prime, so a(4)=2.
%o (Python)
%o from sympy import isprime
%o TOP=1000000
%o for p in range(2,777):
%o if isprime(p):
%o failed = True
%o for x in range(1,TOP):
%o if isprime(p*x+x+1):
%o print str(x)+',',
%o failed = False
%o break
%o if failed: print '-1,',
%o (PARI) a(n) = {x = 1; while (!isprime(prime(n)*x+x+1), x++); x;} \\ _Michel Marcus_, Dec 27 2015
%Y Cf. A000040, A266225.
%K nonn
%O 1,1
%A _Alex Ratushnyak_, Dec 24 2015
|