Given a ‘n’ digit number x, check if it is a plus perfect number or not. A number is plus perfect number if it is equal to the sum of its digits raised to the nth power.
Input : x = 371 Output : Yes Explanation : Number of digits n = 3 (3*3*3) + (7*7*7) + (1*1*1) = 371 Input : x = 9474 Output : Yes Explanation : Number of digits n = 4 (9*9*9*9) + (4*4*4*4) + (7*7*7*7) + (4*4*4*4) = 9474 Input : x = 9473 Output : No Explanation : Number of digits n = 4 (9*9*9*9) + (4*4*4*4) + (7*7*7*7) + (3*3*3*3) != 9474
Below is the implementation to check if a number is plus perfect number or not.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Check if a number is a perfect square having all its digits as a perfect square
- Find smallest perfect square number A such that N + A is also a perfect square number
- Check if it is possible to reach (x, y) from origin in exactly Z steps using only plus movements
- Count numbers upto N which are both perfect square and perfect cube
- C Program to check whether a number is a Perfect Cube or not
- Check if given number is perfect square
- Check whether the number can be made perfect square after adding 1
- Check whether the number can be made perfect square after adding K
- Check if number formed by joining two Numbers is Perfect Cube
- Check if a given number is a Perfect square using Binary Search
- Check if a number can be expressed as sum of two Perfect powers
- Check if a number can be represented as sum of two consecutive perfect cubes
- Check if a number is perfect square without finding square root
- Find minimum number to be divided to make a number a perfect square
- Number of times the largest perfect square number can be subtracted from N
- Minimum divisor of a number to make the number perfect cube
- Previous perfect square and cube number smaller than number N
- Check perfect square using addition/subtraction
- Check if the sum of perfect squares in an array is divisible by x
- Check if product of array containing prime numbers is a perfect square
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.
Improved By : jit_t