OFFSET
1,1
COMMENTS
Is a(n) always positive?
EXAMPLE
a(3) = prime(22) = 79 since least k such that A300845(k) = prime(3) = 5 is 22.
MAPLE
f:= proc(p) local q;
q:= 1;
do
q:= nextprime(q);
if isprime(q^2+q*p+p^2) then return q fi;
od
end proc:
V:= Vector(100):
p:= 1: count:= 0:
while count < 100 do
p:= nextprime(p);
v:= numtheory:-pi(f(p));
if v <= 100 and V[v] = 0 then V[v]:= p; count:= count+1; fi
od:
convert(V, list);
MATHEMATICA
With[{s = Table[Block[{q = 2}, While[! PrimeQ[q^2 + q p + p^2], q = NextPrime@ q]; q], {p, Prime@ Range[10^4]}]}, TakeWhile[#, # > 0 &] &@ Table[Prime@ First@ FirstPosition[s, p] /. k_ /; ! IntegerQ@ k -> -1, {p, Prime@ Range@ PrimePi@ Max@ s}] ] (* Michael De Vlieger, Mar 16 2018 *)
PROG
(PARI) a300845(n) = {my(p=prime(n)); forprime(q=2, , if(isprime(p^2+p*q+q^2), return(q)))}
a(n) = {my(k=1); while(a300845(k) != prime(n), k++); prime(k); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel and Altug Alkan, Mar 13 2018
STATUS
approved