login
Smallest prime p such that p - floor(sqrt(p))^2 = n^2.
1

%I #27 Jan 10 2022 15:26:58

%S 2,13,73,97,281,397,1493,1153,2017,2909,4217,6073,8269,12517,13681,

%T 17417,22193,26893,34217,40801,51517,60509,72353,89977,101749,115597,

%U 151273,158393,180617,204301,237157,278753,335173,336397,388109,435577,477469,527069,585217,652849,717397

%N Smallest prime p such that p - floor(sqrt(p))^2 = n^2.

%C Also the smallest prime p = n^2 + x^2 such that x > n^2/2.

%C For n < 10^6, a(7) > a(8) is the only place where the sequence is not increasing. - _Derek Orr_, Aug 17 2014

%H Robert Israel, <a href="/A242991/b242991.txt">Table of n, a(n) for n = 1..9998</a>

%e 2 = 1^2 + 1^2,

%e 13 = 2^2 + 3^2,

%e 73 = 3^2 + 8^2,

%e 97 = 4^2 + 9^2,

%e 281 = 5^2 + 16^2,

%e 397 = 6^2 + 19^2,

%e ...

%p a:= proc(n) local x,p; for x from ceil(n^2/2) do p:= n^2+x^2; if isprime(p) then return(p) fi od end proc:

%p seq(a(n), n=1..100); # _Robert Israel_, Aug 17 2014

%t spp[n_]:=Module[{p=2},While[p-Floor[Sqrt[p]]^2!=n^2,p=NextPrime[p]];p]; Array[spp,50] (* _Harvey P. Dale_, Jan 10 2022 *)

%o (PARI)

%o a(n)=k=ceil(n^2/2);while(!ispseudoprime(n^2+k^2),k++);return(n^2+k^2)

%o vector(100, n, a(n)) \\ _Derek Orr_, Aug 17 2014

%Y Cf. A145016.

%K nonn

%O 1,1

%A _Thomas Ordowski_, Aug 17 2014

%E More terms from _Derek Orr_, Aug 17 2014