login
A362961
a(n) = Sum_{b=0..floor(sqrt(n)), n-b^2 is square} b.
2
1, 1, 0, 2, 3, 0, 0, 2, 3, 4, 0, 0, 5, 0, 0, 4, 5, 3, 0, 6, 0, 0, 0, 0, 12, 6, 0, 0, 7, 0, 0, 4, 0, 8, 0, 6, 7, 0, 0, 8, 9, 0, 0, 0, 9, 0, 0, 0, 7, 13, 0, 10, 9, 0, 0, 0, 0, 10, 0, 0, 11, 0, 0, 8, 20, 0, 0, 10, 0, 0, 0, 6, 11, 12, 0, 0, 0, 0, 0, 12, 9, 10, 0
OFFSET
1,4
COMMENTS
a(n) = 0 if n in A022544.
a(n) > 0 if n in A001481.
LINKS
MATHEMATICA
a[n_]:=Sum[b Boole[IntegerQ[Sqrt[n-b^2]]], {b, 0, Floor[Sqrt[n]]}]; 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) if is_square(n - (b*b))])
print([a(n) for n in range(1, 84)])
(Python)
from sympy import divisors
from sympy.solvers.diophantine.diophantine import cornacchia
def A362961(n):
c = 0
for d in divisors(n):
if (k:=d**2)>n:
break
q, r = divmod(n, k)
if not r:
c += sum(d*(a[0]+(a[1] if a[0]!=a[1] else 0)) for a in cornacchia(1, 1, q) or [])
return c # Chai Wah Wu, May 15 2023
(PARI) a(n) = sum(b=0, sqrtint(n), if (issquare(n-b^2), b)); \\ Michel Marcus, May 16 2023
CROSSREFS
Cf. A143574 (sum of b^2), A000925.
Sequence in context: A151867 A262563 A170843 * A292596 A011023 A284610
KEYWORD
nonn,look
AUTHOR
Darío Clavijo, May 10 2023
STATUS
approved