login
a(n) is the first prime p such that, with q the next prime, p + q^2 is 10^n times a prime.
2

%I #23 Dec 29 2022 09:16:39

%S 2,409,25819,101119,3796711,4160119,264073519,2310648079,165231073519,

%T 9671986711,18300671986711,154590671986711,2237199609971479,

%U 2735490671986711,193086838131073519,1529978199609971479,3288779373987568759

%N a(n) is the first prime p such that, with q the next prime, p + q^2 is 10^n times a prime.

%C From _Daniel Suteu_, Dec 28 2022: (Start)

%C For n >= 1, a(n) has the form k * 10^n + x, for some k >= 0, where x is a solution to the modular quadratic equation x^2 + (2*d + 1)*x + d^2 == 0 (mod 10^n), where d = q-p.

%C a(17) <= 73421283931459964959, a(18) <= 3895482305490671986711. (End)

%e a(2) = 25819 because 25819 is prime, the next prime is 25841, 25819 + 25841^2 = 667783100 = 6677831*10^2 and 6677831 is prime.

%p V:= Array(0..5):

%p count:= 0:

%p q:= 2:

%p while count < 6 do

%p p:= q; q:= nextprime(p);

%p v:= p+q^2;

%p r:= padic:-ordp(v,2);

%p if r <= 5 and V[r] = 0 and padic:-ordp(v,5) = r and isprime(v/10^r) then

%p V[r]:= p; count:= count+1;

%p fi;

%p od:

%p convert(V,list);

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

%o (PARI)

%o isok(n,p,q) = my(v=valuation(p+q^2, 10)); (v == n) && isprime((p+q^2)/10^v);

%o a(n) = my(p=2); forprime(q=p+1, oo, if(isok(n,p,q), return(p)); p=q); \\ _Daniel Suteu_, Apr 08 2022

%Y Cf. A002386, A352837, A352803.

%K nonn,more

%O 0,1

%A _J. M. Bergot_ and _Robert Israel_, Apr 05 2022

%E a(6)-a(9) from _Amiram Eldar_, Apr 07 2022

%E a(10)-a(16) from _Daniel Suteu_, Dec 28 2022