Problem # 12 : Amicable numbers

A pair of numbers (a b) are amicable if - The sum of the factors of 'a' (excluding 1 and including 'a') is equal to 'b' and the sum of the factors of 'b' is equal to 'a'

Write a function AMICABLE(A B) which returns -1 (true) if A and B are amicable and 0 (false) otherwise

Sample Output
AMICABLE(220 284) returns -1
AMICABLE(6 6) returns -1
AMICABLE(28 28) returns -1
AMICABLE(12 4) returns 0


Previous Problem
Return to problems at The Vault
(Back to problems at The Vault )
Next Problem

LinkExchange
LinkExchange Member
1