friendly numbers
Problem
Friendly Numbers -– are two natural numbers such that the sum of all divisors of one number (less than that number itself) is equal to the other number, and vice versa. Write a program that tests a pair of numbers for "friendliness". Use a function that calculates the sum of the divisors of a number.
Input: The input string contains two natural numbers.
Output: The program should output the word 'YES' if the received numbers – friendly, and the word 'NO' otherwise.
Examples
| # |
Input |
Output |
| 1 |
220 284 |
YES |
| 2 |
1210 1092 |
NO |