login
a(n) is the least prime p such that 2*prime(n)^2 + p is the square of a prime.
2

%I #17 Aug 04 2022 05:04:25

%S 17,7,71,23,47,23,263,239,311,167,887,71,359,23,71,4583,2447,479,431,

%T 1367,1223,4679,2351,1319,503,2399,983,3671,887,1031,503,2927,2063,

%U 167,7127,4127,431,1151,10271,9311,5087,7919,479,4463,8231,887,11447,1031,17351,4679,983,7559,5639,2879,2591

%N a(n) is the least prime p such that 2*prime(n)^2 + p is the square of a prime.

%H Robert Israel, <a href="/A356060/b356060.txt">Table of n, a(n) for n = 1..10000</a>

%F 2*A001248(n) + a(n) = A356048(n)^2.

%e a(3) = 71 because the third prime is 5, 2*5^2 + 71 = 121 = 11^2 where 11 is prime, and 71 is the least prime that works.

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

%p q:= floor(sqrt(2)*n);

%p do

%p q:= nextprime(q);

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

%p od

%p end proc:

%p map(f, [seq(ithprime(i),i=1..100)]);

%o (PARI) a(n) = my(p=2, q=prime(n), s); while (! (issquare(s=2*q^2+p) && isprime(sqrtint(s))), p = nextprime(p+1)); p; \\ _Michel Marcus_, Aug 04 2022

%Y Cf. A001248, A356048.

%K nonn

%O 1,1

%A _J. M. Bergot_ and _Robert Israel_, Jul 24 2022