Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number. (A proper divisor of a number is a positive factor of that number other than the number itself.
Input : x = 220, y = 284 Output : Yes Proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110. Sum of these is 284. Proper divisors of 284 are 1, 2, 4, 71 and 142 with sum 220. Input : 1 2 Output :No
The logic is very simple. We compare sum of the proper divisors of both numbers and compare sum for one number with other number.
- Find the sum of the all amicable numbers up to N
- Check if the given two numbers are friendly pair or not
- Check if there is any pair in a given range with GCD is divisible by k
- Find any pair with given GCD and LCM
- Pair with maximum GCD from two arrays
- Quadruplet pair with XOR zero in the given Array
- Number of triplets such that each value is less than N and each pair sum is a multiple of K
- Find pair with maximum GCD in an array
- Co-prime pair with given sum minimum difference
- Find a pair from the given array with maximum nCr value
- Maximum Bitwise AND pair from given range
- Find a pair (n,r) in an integer array such that value of nCr is maximum
- Find a distinct pair (x, y) in given range such that x divides y
- Find a pair (n,r) in an integer array such that value of nPr is maximum
- Count ways of choosing a pair with maximum difference
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.