login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the smallest prime p = prime(k) such that A300845(k) = prime(n), or 0 if no such k exists.
0

%I #18 Mar 20 2018 00:24:57

%S 3,2,79,5,19,71,211,47,307,181,479,83,1231,293,547,1021,499,683,251,

%T 643,863,2243,1009,1447,2213,3361,4691,2137,2657,2131,929,4621,5851,

%U 1721,7591,1901,11243,3191,19501,3343,2551,2927,997,4703,4177,2789,14537,10331,28723,36899,11311,42433,29429,9631

%N a(n) is the smallest prime p = prime(k) such that A300845(k) = prime(n), or 0 if no such k exists.

%C Is a(n) always positive?

%e a(3) = prime(22) = 79 since least k such that A300845(k) = prime(3) = 5 is 22.

%p f:= proc(p) local q;

%p q:= 1;

%p do

%p q:= nextprime(q);

%p if isprime(q^2+q*p+p^2) then return q fi;

%p od

%p end proc:

%p V:= Vector(100):

%p p:= 1: count:= 0:

%p while count < 100 do

%p p:= nextprime(p);

%p v:= numtheory:-pi(f(p));

%p if v <= 100 and V[v] = 0 then V[v]:= p; count:= count+1; fi

%p od:

%p convert(V,list);

%t 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 *)

%o (PARI) a300845(n) = {my(p=prime(n)); forprime(q=2, ,if(isprime(p^2+p*q+q^2), return(q)))}

%o a(n) = {my(k=1); while(a300845(k) != prime(n), k++); prime(k); }

%Y Cf. A300845.

%K nonn

%O 1,1

%A _Robert Israel_ and _Altug Alkan_, Mar 13 2018