OFFSET
1,1
COMMENTS
Neither x nor y can be zero because the remaining part of the form would then be composite.
a(n) > n.
The differences, d, between a(n) and n are 1, 4, 9, 16, 24, 25, 36, 49, 64, 81, 100, 121, 132, 144, 169, 196, 225, 256, 258, 289, 324, 361, 400, 441, ..., .
Not all 'd's are squares, such as 24, 132, 258, 1032, 1167, 1518, 2103, 2472, 2652, 2706, 5793. It is conjectured that this list is complete.
d=1 for A006093;
d=4 for A172367;
d=9 for n: 8, 14, 20, 32, 34, 38, 44, 50, 62, 64, 74, 80, 92, 94, 98, 104, 118, 122, 128, 140, 142, 154, 158, ..., ;
d=16 for n: 21, 31, 45, 51, 73, 81, 87, 91, 111, 115, 121, 141, 151, 157, 165, 181, 183, 211, 213, 217, 241, ..., ;
d=25 for n: 48, 54, 76, 84, 114, 124, 132, 168, 174, 186, 204, 208, 216, 244, 246, 252, 258, 286, 288, 324, ..., ;
d=36 for n: 11, 17, 23, 35, 47, 53, 61, 65, 71, 77, 95, 101, 113, 131, 137, 143, 155, 161, 191, 197, 203, 205, ..., ;
d=49 for n: 24, 90, 144, 234, 264, 300, 318, 360, 390, 450, 472, 492, 528, 550, 558, 564, 624, 670, 678, 712, ..., ;
and for the nonsquare differences of 24, 132, 258, 1032, 1167, 1518, 2103, 2472, 2652, 2706 and 5793l, their n's are 5, 41, 59, 341, 314, 479, 626, 749, 881, 755 and 1784, respectively.
Least n that has as its difference k^2: 1, 3, 8, 21, 48, 11, 24, 117, 26, 139, 120, 29, 294, 201, 134, 621, 468, 179, 792, 1269, 356, 1249, 754, 251, 696, ..., .
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n-1) = n iff n is prime.
EXAMPLE
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.
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]
PROG
(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<best, best=t))); best \\ Charles R Greathouse IV, Jul 17 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov and Robert G. Wilson v, Jul 17 2016
STATUS
approved