A363051 a(n) = Sum_{b=0..floor(sqrt(n/2)), n-b^2 is square} b.
0, 1, 0, 0, 1, 0, 0, 2, 0, 1, 0, 0, 2, 0, 0, 0, 1, 3, 0, 2, 0, 0, 0, 0, 3, 1, 0, 0, 2, 0, 0, 4, 0, 3, 0, 0, 1, 0, 0, 2, 4, 0, 0, 0, 3, 0, 0, 0, 0, 6, 0, 4, 2, 0, 0, 0, 0, 3, 0, 0, 5, 0, 0, 0, 5, 0, 0, 2, 0, 0, 0, 6, 3, 5, 0, 0, 0, 0, 0, 4, 0, 1, 0
Offset: 1
Keywords
Links
- Project Euler, Problem 273: Sum of Squares
Programs
-
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 *)
-
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
Comments