Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 35s1 days 16 hours 1 minutes 35 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 35s1 days 16 hours 1 minutes 35 seconds.

Sign in to watch this lesson
Algorithms - Bits and Number Theory · 4:03
A divisor of n = p1^e1 * p2^e2 * ... is a choice of exponents, so 60 = 2^2 * 3 * 5 becomes a 3 x 2 x 2 block of 12 cubes, one per divisor, and weighting each cube by its value factors the sum as (1+2+4)(1+3)(1+5) = 168. We turn both formulas into an O(sqrt(n)) trial-division routine, avoid the leftover-prime and overflow traps of the closed form, and fill a whole table of divisor sums by adding every d to its multiples in n ln n steps, measured on this Mac against the linear sieve.