login
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
OFFSET
1,3
LINKS
FORMULA
a(n) = A024916(n) - A006218(n).
a(n) = (1/2) * Sum_{i=1..n} floor(n/i) * floor((n-i)/i). - Wesley Ivan Hurt, Jan 30 2016
a(n) = Sum_{i=1..n} binomial(floor(n/i),2). - Wesley Ivan Hurt, May 08 2016
a(n) = Sum_{k=1..n} (k-1) * floor(n/k). - Wesley Ivan Hurt, Apr 02 2017
a(n) = (1/2)*(A222548(n) - A006218(n)). - Ridouane Oudra, Aug 01 2019
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
A236632:=n->(1/2)*add(floor(n/i)*floor((n-i)/i), i=1..n): seq(A236632(n), n=1..100); # Wesley Ivan Hurt, Jan 30 2016
N:= 1000: # to get a(1) to a(N)
A065608:= Vector(N):
for a from 1 to floor(sqrt(N)) do for b from a to N/a do
if b = a then
A065608[a*b] := A065608[a*b] + a - 1
else
A065608[a*b] := A065608[a*b] + a + b - 2;
fi
od od:
ListTools:-PartialSums(convert(A065608, list)); # Robert Israel, May 16 2016
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 *)
Table[Sum [(k - 1) Floor[n/k], {k, n}], {n, 51}] (* Michael De Vlieger, Apr 03 2017 *)
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
Partial sums of A065608.
Sequence in context: A105876 A354801 A141101 * A098379 A329482 A049754
KEYWORD
nonn,easy
AUTHOR
Omar E. Pol, Jan 31 2014
STATUS
approved