%I #14 Jul 15 2018 12:27:40
%S 2,0,3,2,23,19,2,3,47,2,5,43,2,7,83,2,0,3,2,11,79,2,3,0,2,0,103,2,17,
%T 13,2,5,3,2,0,7,2,3,5,2,0,163,2,257,263,2,7,3,2,0,0,2,3,0,2,61,223,2,
%U 11,5,2,47,3,2,41,73,2,3,7,2,317,11,2,5,19,2,0,3,2,7,5,2,3,829,2,17,0,2,67,0
%N a(n) = prime(x) is the smallest prime such that 1+n*prime(x) is divisible by prime(x+1), or 0 if no such prime exists.
%C Two unsolved problems:
%C 1. Given arbitrary n, does there exist an m such that 1 + n*prime(x) = m*prime(x+1) is solvable? For several n (e.g., n = 17, 24, 26, 35, 41, 50, 51, 54, 87) a search up to x=10000000 did not provide a prime(x) solution.
%C 2. If a solution exists, then the number of solutions is believed to be finite. E.g., at n=2122, 8 solutions were found after an extensive search {prime(x)} = {2, 19, 23, 37, 89, 433, 4241, 7621}.
%F a(n) = Min{prime(x); (1 + n*prime(x)) mod prime(x+1) = 0}; a(n) = p; 1 + n*p = m*q where {p, q} are smallest consecutive primes satisfying relation belonging to n.
%e n=1: 1 + 1*p = q is satisfied by the consecutive prime pair {2,3}; a(1)=2.
%e n=2: 1 + 2*p = m*q, no solution.
%e n=6: 1 + 6*p = m*q is satisfied first by {p,q} = {19,23} because 6*19 + 1 = 115 = 5*23.
%e It is provable that there are arbitrarily large n to which (a finite number of) solutions exist.
%t {k=0, nu=0; sq={}}; Table[Print[{n-1, Min[Prime[sq]]}]; nu=0; sq={}; Do[s=Mod[n*Prime[x]+1, Prime[x+1]]; If[Equal[s, 0], nu=nu+1; sq=Append[sq, n]], {x, 1, 10000000}], {n, 1, 257}]
%o (PARI) a(n) = local(i, c, p, q); i = 1; c = 0; q = 2; while (1, p = q; q = prime(i + 1); if (!((1 + n*p)%q), return(p)); if ((i + n*p)/q > n - 1/10, c++; if (c == 8, return(0)), c = 0); i++); \\ _David Wasserman_, Jun 17 2005
%Y Cf. A087986.
%K nonn
%O 1,1
%A _Labos Elemer_, Oct 06 2003
%E More terms from _David Wasserman_, Jun 17 2005