OFFSET
1,8
LINKS
Project Euler, Problem 273: Sum of Squares
MAPLE
A363051 := proc(n)
local x, a ;
a := 0 ;
for x from 1 do
if x^2 > n/2 then
return a;
end if;
if issqr(n-x^2) then
a := a+x ;
end if;
end do:
end proc:
seq(A363051(n), n=1..100) ; # R. J. Mathar, Jan 31 2024
MATHEMATICA
a[n_]:=Sum[b Boole[IntegerQ[Sqrt[n-b^2]]], {b, 0, Floor[Sqrt[n/2]]}]; Array[a, 83] (* Stefano Spezia, May 15 2023 *)
PROG
(Python)
from gmpy2 import *
a = lambda n: sum([b for b in range(0, isqrt(n >> 1) + 1) if is_square(n - (b*b))])
print([a(n) for n in range(1, 84)])
(Python)
from sympy.solvers.diophantine.diophantine import diop_DN
def A363051(n): return sum(min(a) for a in diop_DN(-1, n))>>1 # Chai Wah Wu, May 16 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Darío Clavijo, May 14 2023
STATUS
approved