login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the least prime p such that k*(p^2-1)+2*n+1 is prime for k=1..2*n, or 0 if there is no such p.
0

%I #5 Feb 23 2022 09:21:30

%S 3,7,423281,0

%N a(n) is the least prime p such that k*(p^2-1)+2*n+1 is prime for k=1..2*n, or 0 if there is no such p.

%C If n == 1 (mod 3) and n > 1, then a(n) = 0.

%C a(5) > 10^10 if it is not 0.

%e a(2) = 7 because 5 + 1*(7^2-1) = 53, 5 + 2*(7^2-1) = 101, 5 + 3*(7^2-1) = 149 and 5 + 4*(7^2-1) = 197 are all prime.

%p f:= proc(n) local p,pmax,k;

%p if n mod 3 = 1 then

%p if n=1 then return 3 else return 0 fi

%p fi;

%p p:= 1:

%p while p < 10^8 do

%p p:= nextprime(p);

%p if andmap(isprime, [seq(k*(p^2-1)+2*n+1, k=1..2*n)]) then return p fi

%p od;

%p FAIL

%p end proc:

%p map(f, [$1..5]);

%K nonn,more

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Feb 21 2022