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
- Find pair with maximum GCD in an array
- Number of triplets such that each value is less than N and each pair sum is a multiple of K
- Co-prime pair with given sum minimum difference
- Maximum Bitwise AND pair from given range
- Find a pair from the given array with maximum nCr value
- Find a distinct pair (x, y) in given range such that x divides y
- Find the shortest distance between any pair of two different good nodes
- Count ways of choosing a pair with maximum difference
- Find a pair with maximum product in array of Integers
- Pair of prime numbers with a given sum and minimum absolute 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.