OFFSET
1,2
COMMENTS
Conjecture: for each n there exists such a number k.
Note: a(2m+1) > 1 is a prime p and a(2m) > 2 is a double prime 2q, where p and q are primes == 1 (mod 4).
For odd n > 1, a(n) is the smallest prime of the form x^2 + (n - x)^2.
For even n > 2, a(n) is the smallest double prime of the above form.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
f:= proc(n) local k, v;
for k from ceil(n/2) to n do
v:= k^2+(n-k)^2;
if n::odd then if isprime(v) then return v fi
elif isprime(v/2) then return v
fi
od;
FAIL
end proc:
f(1):=1: f(2):= 2:
map(f, [$1..100]); # Robert Israel, Dec 30 2020
PROG
(PARI) isok(k, n) = {nba = 0; nbb = 0; for (x=0, k, if (issquare(x) && issquare(k-x), if (x <= k - x, nba++; if (nba > 1, return (0)); rx = sqrtint(x); ry = sqrtint(k-x); if ((gcd(rx, ry)==1) && (rx+ry == n), nbb++; ); ); ); ); if (nbb, return (k), return(0)); }
a(n) = {k = 1; while (! (s = isok(k, n)), k++; ); s; } \\ Michel Marcus, Jan 20 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Jan 18 2017
EXTENSIONS
More terms from Altug Alkan, Jan 18 2017
More terms from Jon E. Schoenfield, Jan 18 2017
STATUS
approved