A number N is said to be Multiply-perfect numbers if N divides sigma(N), where sigma(N) = sum of all divisors of N.
The first few Multiply-perfect numbers are:
1, 6, 28, 120, 496, 672, ……..
Check if N is a Multiply-perfect number
Given a number N, the task is to find if this number is Multiply-perfect number or not.
Input: N = 120
Sum of 120’s divisors is 1 + 2 + 3 + 4 + 5 + 6 + 8 + 10 + 12 + 15 + 20 + 24 + 30 + 40 + 60 + 120 = 360 and 120 divides 360.
Therefore, 120 is a Multiply-perfect number.
Input: N = 32
Approach: For a number N to be Multiply-perfect number, the following condition should hold true: sigma(N) % N = 0, where sigma(N) = sum of all divisors of N. Therefore, we will find sum of all divisors of N and check if it is divisible by N or not. If divisible print “Yes” else print “No.
Below is the implementation of the above approach:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Find smallest perfect square number A such that N + A is also a perfect square number
- Find the smallest number whose digits multiply to a given number n
- Multiply the given number by 2 such that it is divisible by 10
- Queries to multiply the given subarray with given number X and print sum
- Smallest number to multiply to convert floating point to natural
- Find minimum number to be divided to make a number a perfect square
- Previous perfect square and cube number smaller than number N
- Number of times the largest perfect square number can be subtracted from N
- Minimum divisor of a number to make the number perfect cube
- Count numbers upto N which are both perfect square and perfect cube
- Perfect Number
- Almost Perfect Number
- Anti-perfect Number
- Perfect totient number
- Perfect cube greater than a given number
- Number of perfect squares between two given numbers
- Check if given number is perfect square
- Number of perfect cubes between two given numbers
- Program to check Plus Perfect Number
- Count all perfect divisors of a number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.