Two numbers were having a conversation about their social lives.
28: Did you hear that 284 broke up with 220?
6: I’m not surprised. He’s far from perfect. But at least their break-up was amicable.
28: Yeah, well, I heard she started seeing 12.
6: Really? He doesn’t have abundant charm. Don’t you think 10 would be a better match for her?
28: I don’t know. He seems so solitary!
Speaking of factors, I learned a neat trick this weekend for finding the sum of the factors of a number. Before I share that, consider the method for determining how many factors a number has. Take the number 12, for instance. The prime factorization of 12 is:
12 = 22 × 3
The following array can be used to generate all of the factors of 12:
It’s obvious from the array that there are six factors. But the trick is to notice that each factor in the array is made from a power of 2 times a power of 3 — that is, each factor is equal to 2m × 3n, where 0 ≤ m ≤ 2 and 0 ≤ n ≤ 1. Since there are three possible values of m and two possible values for n, then there are 3 × 2 = 6 factors of 12.
In general, if the prime factorization of the number takes the form ap × bq × cr, then the number of factors is (p + 1)(q + 1)(r + 1) for exponents p, q, and r. (The process could obviously be extended if there are more than three prime factors.)
But look at the array again. The sum of all factors of 12 is equal to sum of all products that occur within the array. However, there is an easy way to find that sum, by taking advantage of the distributive property. The sum of the powers of 2 along the top is 20 + 21 + 22 = 7, and the sum of the powers of 3 along the left side is 30 + 31 = 4. Consequently, the sum of all factors of 12 is equal to:
(20 + 21 + 22)(30 + 31) = 7 × 4 = 28
In general, if the prime factorization of a number is ap × bq × cr, then the sum of the factors is:
(a0 + a1 + … + ap)(b0 + b1 + … + bq)(c0 + c1 + … + cr)
And again, this could be extended if the number had more than three prime factors.