OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 11 because (11+13)/(2*3) = 4 = 2^2 where 2 is prime, and 11 is the first prime that works.
MAPLE
f:= proc(n) local r, v, p, q;
r:= 1:
do
r:= nextprime(r);
v:= n*r^2;
p:= prevprime(v);
if 2*v-p = nextprime(v) then return p fi
od
end proc:
map(f, [$1..100]);
MATHEMATICA
f[n_] := Module[{r, v, p, q}, r = 1; While[True, r = NextPrime[r]; v = n*r^2; p = NextPrime[v, -1]; If[2*v - p == NextPrime[v], Return[p]]]];
Table[f[n], {n, 1, 100}] (* Jean-François Alcover, Oct 16 2022, after Robert Israel *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Sep 25 2022
STATUS
approved