OFFSET
0,5
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
FORMULA
EXAMPLE
A000161(25)=#{5^2+0^2,4^2+3^2}=2: a(25)=25+0+16+9=50;
A000161(26)=#{5^2+1^2}=1: a(16)=25+1=26;
A000161(49)=#{7^2+0^2}=1: a(49)=49+0=49;
A000161(50)=#{7^2+1^2,5^2+5^2}=2: a(50)=49+1+25=75;
A000161(2600)=#{50^2+10^2,46^2+22^2,38^2+34^2}=3: a(2600)=2500+100+2116+484+1444+1156=7800;
A000161(2601)=#{51^2+0^2,45^2+24^2}=2: a(2601)=2601+0+12025+576=5202;
A000161(2602)=#{51^2+1^2}=1: a(2602)=2601+1=2602.
PROG
(Python)
from sympy import divisors
from sympy.solvers.diophantine.diophantine import cornacchia
def A143574(n):
c = 0
for d in divisors(n):
if (k:=d**2)>n:
break
q, r = divmod(n, k)
if not r:
c += sum(k*(a[0]**2+(a[1]**2 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(k=1, n, if (issquare(k) && issquare(n-k), k)); \\ Michel Marcus, May 16 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Aug 24 2008
STATUS
approved