from collections import Counter
from math import gcd
def factor(m):
n = m
f = []
for d in [2, 3, 5]:
while n % d == 0:
f.append(d)
n //= d
inc = (4, 2, 4, 2, 4, 6, 2, 6)
i, d = 0, 7
while d * d <= n:
while n % d == 0:
n //= d
f.append(d)
d += inc[i]
i = (i + 1) % 8
if n > 1:
f.append(n)
return Counter(f)
def delta(n):
c = factor(n)
return sum(v * (n // k) for k, v in c.items())
for n in range(1, 100):
print(delta(n))
To embed this program on your website, copy the following code and paste it into your website's HTML: