|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
|
|
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
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 [])
(PARI) a(n) = sum(b=0, sqrtint(n), if (issquare(n-b^2), b)); \\ Michel Marcus, May 16 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|