OFFSET
1,2
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4) = 3 because the 4th prime is 7 and there is an arithmetic progression of 3 primes ending in 7, namely 3, 5, 7, and no such arithmetic progression of 4 primes.
MAPLE
f:= proc(n) local s, i, m, 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 m fi;
for j from 2 while isprime(s-j*d) do od;
m:= max(m, j);
od;
m
end proc:
map(f, [$1..100]);
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Aug 11 2024
STATUS
approved