OFFSET
2,2
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
EXAMPLE
a(4) = 2 because the 4th prime is 7 and the arithmetic progression of 3 primes ending in 7, namely 3, 5, 7, has common difference 2.
MAPLE
f:= proc(n) local s, i, m, dd, d, j;
m:= 1;
s:= ithprime(n);
for i from n-1 to 1 by -1 do
d:= s - ithprime(i);
if s - m*d < 2 then return dd fi;
for j from 2 while isprime(s-j*d) do od;
if j > m then m:= j; dd:= d fi;
od;
dd
end proc:
map(f, [$2..100]);
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Robert Israel, Aug 13 2024
STATUS
approved