Solved 021.
Cheats slightly by using a pre-computed list of amicable numbers.