|
|
A236632
|
|
Sum of all divisors of all positive integers <= n minus the total number of divisors of all positive integers <= n.
|
|
3
|
|
|
0, 1, 3, 7, 11, 19, 25, 36, 46, 60, 70, 92, 104, 124, 144, 170, 186, 219, 237, 273, 301, 333, 355, 407, 435, 473, 509, 559, 587, 651, 681, 738, 782, 832, 876, 958, 994, 1050, 1102, 1184, 1224, 1312, 1354, 1432, 1504, 1572, 1618, 1732, 1786, 1873, 1941
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
FORMULA
|
a(n) = (1/2) * Sum_{i=1..n} floor(n/i) * floor((n-i)/i). - Wesley Ivan Hurt, Jan 30 2016
|
|
EXAMPLE
|
For n = 6 the sets of divisors of the positive integers <= 6 are {1}, {1, 2}, {1, 3}, {1, 2, 4}, {1, 5}, {1, 2, 3, 6}. There are 14 total divisors and their sum is 1 + 3 + 4 + 7 + 6 + 12 = 33, so a(6) = 33 - 14 = 19.
|
|
MAPLE
|
N:= 1000: # to get a(1) to a(N)
for a from 1 to floor(sqrt(N)) do for b from a to N/a do
if b = a then
else
fi
od od:
|
|
MATHEMATICA
|
Table[Sum[Floor[n/i]*Floor[(n - i)/i], {i, n}]/2, {n, 50}] (* Wesley Ivan Hurt, Jan 30 2016 *)
Table[Sum[Binomial[Floor[n/i], 2], {i, n}], {n, 51}] (* Michael De Vlieger, May 15 2016 *)
Accumulate@ Table[DivisorSum[n, # - 1 &], {n, 51}] (* or *)
|
|
PROG
|
(PARI) a(n) = sum(i=1, n, sigma(i)) - sum(i=1, n, numdiv(i)); \\ Michel Marcus, Feb 01 2014
(Magma) [(&+[DivisorSigma(1, k) - DivisorSigma(0, k) : k in [1..n]]): n in [1..60]]; // Vincenzo Librandi, Aug 02 2019
(Python)
from math import isqrt
def A236632(n): return (s:=isqrt(n))**2*(1-s)+sum((q:=n//k)*((k<<1)+q-3) for k in range(1, s+1))>>1 # Chai Wah Wu, Oct 23 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|