Amicable pairs

FCC link

Two integers $N$ and $M$ are said to be amicable pairs if $N \neq M$ and the sum of the proper divisors of $N$ ($\mathrm{sum}(\mathrm{propDivs}(N))$) $= M$ as well as $\mathrm{sum}(\mathrm{propDivs}(M)) = N$.

Example:

1184 and 1210 are an amicable pair, with proper divisors:

  • 1, 2, 4, 8, 16, 32, 37, 74, 148, 296, 592 and
  • 1, 2, 5, 10, 11, 22, 55, 110, 121, 242, 605 respectively.

Test

{{test}}

Console output