OFFSET
1,1
EXAMPLE
7 is prime, (7^2+2)/3 = 17 is prime, (17^2+2)/3 = 97 is prime, (97^2+2)/3 = 3137 is prime, but (3137^2+2)/3 = 3280257 is not prime, so 7 begins the sequence of 4 primes (7, 17, 97, 3137). Since this is the first prime to do so, a(4) = 7.
MAPLE
f:= proc(p) option remember; local q;
q:= (p^2+2)/3;
if isprime(q) then 1 + procname(q) else 1 fi
end proc:
A:= Vector(5): count:= 0:
p:= 3:
while count < 5 do
p:= nextprime(p);
v:= f(p);
if A[v] = 0 then A[v]:= p; count:= count+1; fi;
od:
convert(A, list);
MATHEMATICA
f[n_] := -1 + Length @ NestWhileList[(#^2 + 2)/3 &, n, PrimeQ]; a[n_] := Module[{p = 3}, While[f[p] != n, p = NextPrime[p]]; p]; Array[a, 4] (* Amiram Eldar, Feb 01 2022 *)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
J. M. Bergot and Robert Israel, Jan 30 2022
EXTENSIONS
a(6) from Amiram Eldar, Feb 01 2022
STATUS
approved