OFFSET
1,3
COMMENTS
Sum of all squares of proper divisors of all positive integers <= n.
Total volume of all rectangular prisms with dimensions (x, x, z) and integers x and y, such that x + y = n, 0 < x <= y, and z = floor(y/x). - Wesley Ivan Hurt, Dec 21 2020
FORMULA
G.f.: -x*(1 + x)/(1 - x)^4 + (1/(1 - x))*Sum_{k>=1} k^2*x^k/(1 - x^k).
a(n) = Sum_{k=1..n} A067558(k).
a(p^k) = a(p^k-1) + (p^(2*k) - 1)/(p^2 - 1), for p is prime.
a(n) ~ ((zeta(3) - 1)/3)*n^3.
a(n) = Sum_{k=1..floor(n/2)} k^2 * floor((n-k)/k). - Wesley Ivan Hurt, Dec 21 2020
EXAMPLE
For n = 7 the proper divisors of the first seven positive integers are {0}, {1}, {1}, {1, 2}, {1}, {1, 2, 3}, {1} so a(7) = 0^2 + 1^2 + 1^2 + 1^2 + 2^2 + 1 ^2 + 1^2 + 2^2 + 3^2 + 1^2 = 23.
MATHEMATICA
Table[Sum[k^2 (Floor[n/k] - 1), {k, 1, n}], {n, 55}]
Table[Sum[DivisorSigma[2, k] - k^2, {k, 1, n}], {n, 55}]
PROG
(PARI) a(n) = sum(k=1, n, k^2*(floor(n/k)-1)) \\ Felix Fröhlich, Dec 20 2016
(Python)
from math import isqrt
def A279847(n): return (-n*(n+1)*(2*n+1)-(s:=isqrt(n))**2*(s+1)*(2*s+1) + sum((q:=n//k)*(6*k**2+q*(2*q+3)+1) for k in range(1, s+1)))//6 # Chai Wah Wu, Oct 21 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ilya Gutkovskiy, Dec 20 2016
STATUS
approved