This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A375202 #20 Oct 16 2024 12:04:21 %S A375202 0,0,0,1,0,0,1,-1,0,0,0,1,2,0,1,-1,0,0,0,1,0,1,2,-1,2,0,0,1,-1,0,1,-1, %T A375202 0,1,0,1,0,0,1,-1,0,0,1,3,2,0,1,-1,4,0,0,1,0,0,1,-1,2,2,0,1,-1,0,1,-1, %U A375202 0,0,1,3,0,1,3,-1,0,0,0,1,2,2,2,-1,0,0,0,1,2,0,1,-1,4,0,0,1,-1,2,2 %N A375202 a(n) is the least integer x >= 0 such that n = x^2 + y^2 + z^2 for some integers y, z, or -1 if there is no such x. %H A375202 Robert Israel, <a href="/A375202/b375202.txt">Table of n, a(n) for n = 0..10000</a> %H A375202 Mathematics StackExchange, <a href="https://math.stackexchange.com/questions/4985056/large-smallest-square-in-a-sum-of-three-squares#4985056">Large smallest square in a sum of three squares?</a> %F A375202 a(n) = A064874(n) if a(n) >= 0. %F A375202 If a(n) = -1 then a(4*n) = -1, otherwise a(4*n) = 2*a(n). %e A375202 a(12) = 2 because 12 = 2^2 + 2^2 + 2^2 but there are no integer solutions to 12 = 0^2 + y^2 + z^2 or 12 = 1^2 + y^2 + z^2. %p A375202 f:= proc(n) local q,x,y,z; %p A375202 if n/4^padic:-ordp(n,4) mod 8 = 7 then return -1 fi; %p A375202 for x from 0 while 3*x^2 <= n do %p A375202 if [isolve(y^2 + z^2 = n - x^2)] <> [] then return x fi %p A375202 od; %p A375202 end proc; %p A375202 map(f, [$0..100]); %o A375202 (Python) %o A375202 from math import isqrt %o A375202 from sympy import factorint %o A375202 def A375202(n): %o A375202 v = (~n & n-1).bit_length() %o A375202 if v&1^1 and n>>v&7==7: return -1 %o A375202 for x in range(isqrt(n//3)+1): %o A375202 if not any(e&1 and p&3==3 for p, e in factorint(n-x**2).items()): %o A375202 return x # _Chai Wah Wu_, Oct 16 2024 %Y A375202 Cf. A064874, A375203, A375204. %K A375202 sign %O A375202 0,13 %A A375202 _Robert Israel_, Oct 15 2024