OFFSET
1,3
FORMULA
a(n) = Sum_{d|n} Sum_{k=1..d} k * (ceiling(d/k) - floor(d/k)).
a(n) = Sum_{k=1..n} Sum_{i=1..k} i * (ceiling(k/i) - floor(k/i)) * (1 - ceiling(n/k) + floor(n/k)).
EXAMPLE
a(12) = 64. The divisors of 12 are {1,2,3,4,6,12}. There are 0 numbers (positive integers) less than 1, 0 numbers less than 2 not dividing 2, 1 number less than 3 not dividing 3 (namely 2), 1 number less than 4 not dividing 4 (namely 3), 2 numbers less than 6 not dividing 6 (namely 4 and 5) and 6 numbers less than 12 not dividing 12 (namely 5,7,8,9,10,11). The sum of the numbers is then: (2)+(3)+(4+5)+(5+7+8+9+10+11) = 64.
MATHEMATICA
Table[Sum[Sum[k (Ceiling[d/k] - Floor[d/k]), {k, d}], {d, Divisors[n]}], {n, 100}]
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Jan 20 2024
STATUS
approved