Advertisement
istinishat

sum of divisors

Nov 7th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Finding the sum of the divisors of n
  3.  
  4. Last week, we found an efficient way to calculate D(n), the number of divisors of n. This week, we turn to the problem of finding a better way to calculate the sum S(n) of all the divisors of n.
  5.  
  6. For example, suppose we want to find the sum of the divisors of n = 144.
  7.  
  8. As we did last week, we begin by forming the prime factorization of 144:
  9.  
  10. 144 = 24 . 32.
  11.  
  12. Any divisor of 144 must be a product of some number of 2's (between 0 and 4) and some number of 3's (between 0 and 2). So here's a table of the possibilities:
  13.  
  14.     20  21  22  23  24  Row sum
  15. 30  1   2   4   8   16  31
  16. 31  3   6   12  24  48  93
  17. 32  9   18  36  72  144     279
  18. Column sum  13  26  52  103     206     403
  19.  
  20. Notice in the table that the first column sum is 1+3+9=13. And the other column sums are 13 . 2, then 13 . 4, and so forth.
  21.  
  22. So the total is the product of 1 + 3 + 9 =13 with 1 + 2 + 4 + 8 + 16 = 31.
  23.  
  24. Notice that we could write the true equation that:
  25.  
  26. S(144) = S(24 . 32) = S(24) . S(32).
  27.  
  28. In general, if you have the prime factorization of the number n, then to calculate the sum of its divisors, you take each different prime factor and add together all its powers up to the one that appears in the prime factorization, and then multiply all these sums together!
  29.  
  30. Example: Determine S(1800).
  31.  
  32. Solution: The prime factorization of 1800 is 23 . 32 . 52. And
  33.  
  34. S(23) = 1 + 2 + 4 + 8 = 15
  35. S(32) = 1 + 3 + 9 = 13
  36. S(52) = 1 + 5 + 25 = 31
  37.  
  38. Therefore S(1800) = 15 . 13 . 31 = 6045.
  39.  
  40. One last thing that would help is to have a formula for calculating
  41.  
  42. S(pk) = 1 + p + p2 + . . . + pk
  43.  
  44. Here it is (we'll talk about why it's true in class):
  45.  
  46. S(pk) = 1 + p + p2 + . . . + pk = (pk+1 - 1) / (p-1) .
  47.  
  48. One for you: Calculate S(1,000,000).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement