Amicable numbers, also restructuring a bit to ease reuse of functions used across many problems