A352848 a(n) is the first prime p such that, with q the next prime, p + q^2 is 10^n times a prime.
2, 409, 25819, 101119, 3796711, 4160119, 264073519, 2310648079, 165231073519, 9671986711, 18300671986711, 154590671986711, 2237199609971479, 2735490671986711, 193086838131073519, 1529978199609971479, 3288779373987568759
Offset: 0
Examples
a(2) = 25819 because 25819 is prime, the next prime is 25841, 25819 + 25841^2 = 667783100 = 6677831*10^2 and 6677831 is prime.
Programs
-
Maple
V:= Array(0..5): count:= 0: q:= 2: while count < 6 do p:= q; q:= nextprime(p); v:= p+q^2; r:= padic:-ordp(v,2); if r <= 5 and V[r] = 0 and padic:-ordp(v,5) = r and isprime(v/10^r) then V[r]:= p; count:= count+1; fi; od: convert(V,list);
-
Mathematica
seq[len_] := Module[{p = 2, q, s = Table[0, {len}], c = 0, r, e}, While[c < len, q = NextPrime[p]; r = p + q^2; e = IntegerExponent[r, 10] + 1; If[e <= len && s[[e]] == 0 && PrimeQ[r/10^(e - 1)], c++; s[[e]] = p]; p = q]; s]; seq[6] (* Amiram Eldar, Apr 07 2022 *)
-
PARI
isok(n,p,q) = my(v=valuation(p+q^2, 10)); (v == n) && isprime((p+q^2)/10^v); a(n) = my(p=2); forprime(q=p+1, oo, if(isok(n,p,q), return(p)); p=q); \\ Daniel Suteu, Apr 08 2022
Extensions
a(6)-a(9) from Amiram Eldar, Apr 07 2022
a(10)-a(16) from Daniel Suteu, Dec 28 2022
Comments