Amicable Numbers

Two integers m and n are called amicable if the sum of proper divisors of m is equal to n and the sum of proper divisors of n is equal to m. For example, 220 and 284 form a pair of amicable numbers: 1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284; 1 + 2 + 4 + 71 + 142 = 220.

  1. Write a method public int sumProperDivisors(int n) that calculates the sum of all proper divisors of a positive integer n. (Proper divisors of a positive integer are positive numbers less than the integer that divide it without remainder.)
  2. Write a method public boolean areAmicable(int m, int n) that returns true if m and n are amicable, otherwise false.

Include an initial comment with an @author YOUR NAME <your@email.address> line in all solution files.

(Adapted from Java Methods, Chapter 8. Thanks Maria & Gary!)