Data Structures & AlgorithmsHardProduct Company SDE · CP practice

Problem: What is the sum of all proper divisors of 220 (divisors smaller than 220)? Run the code.

Problem: What is the sum of all proper divisors of 220 (divisors smaller than 220)? Run the code.
print(sum(d for d in range(1, 220) if 220 % d == 0))
What is printed?
  1. A. 504
  2. B. 18
  3. C. 284
  4. D. 11

Correct answer: C. 284

220 = 2² · 5 · 11; its proper divisors 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110 sum to 284, the amicable partner of 220. Including 220 itself gives σ(220) = 504, adding the distinct primes gives 18, and 11 counts the proper divisors.

More Coding Interview Problems questions

Exams that ask this topic