A275115 Least prime of the form x^2 + n*y^2 with x>0 and y>0.
2, 3, 7, 5, 29, 7, 11, 17, 13, 11, 47, 13, 17, 23, 19, 17, 53, 19, 23, 29, 37, 23, 59, 73, 29, 107, 31, 29, 173, 31, 47, 41, 37, 43, 71, 37, 41, 47, 43, 41, 173, 43, 47, 53, 61, 47, 83, 73, 53, 59, 67, 53, 89, 79, 59, 137, 61, 59, 317, 61, 97, 71, 67, 73, 101, 67, 71, 149, 73, 71
Offset: 1
Keywords
Examples
a(1) = 2 since it equals 1^2+1*1^2; a(2) = 3 since it equals 1^2+2*1^2; a(3) = 7 since it equals 2^2+3*1^2; a(4) = 5 since it equals 1^2+4*1^2; a(5) = 29 since it equals 3^2+5*2^2; etc.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
- Zak Seidov, First ten primes of the form x^2+n*y^2 with x>=0, y>=0, n=1..1000.
Crossrefs
Programs
-
Mathematica
f[n_] := Block[{p = NextPrime@ n, y}, While[y = 1; While[p > n*y^2 && !IntegerQ[ Sqrt[p - n*y^2]], y++]; !IntegerQ[ Sqrt[p - n*y^2]], p = NextPrime@ p]; p]; Array[f, 70]
-
PARI
a(n)=if(n==1, return(2)); my(best,x=1+n%2,t); while(!isprime(best=x^2+n), x += 2); for(y=2,sqrtint((best-2)\n), t=best-n*y^2; if(t<1, return(best)); for(x=1,sqrtint(t), if(isprime(t=x^2+n*y^2) && t
Charles R Greathouse IV, Jul 17 2016
Formula
a(n-1) = n iff n is prime.
Comments