A281229 Smallest number k of the form x^2 + y^2 with 0 <= x <= y such that gcd(x, y) = 1, x + y = n, and k has no other decompositions into a sum of two squares.
1, 2, 5, 10, 13, 26, 29, 34, 41, 58, 61, 74, 89, 106, 113, 146, 149, 194, 181, 202, 233, 274, 269, 386, 313, 346, 389, 394, 421, 458, 521, 514, 557, 586, 613, 698, 709, 794, 761, 802, 853, 914, 929, 1018, 1013, 1186, 1109, 1154, 1201, 1282, 1301, 1354, 1409
Offset: 1
Keywords
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
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
-
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
Extensions
More terms from Altug Alkan, Jan 18 2017
More terms from Jon E. Schoenfield, Jan 18 2017
Comments