A number is said to be a Peterson number if the sum of factorials of each digit of the number is equal to the number itself.
Input : n = 145 Output = Yes Explanation: 145 = 5! + 4! + 1! = 120 + 24 +1 = 145 Input : n = 55 Output : No Explanation: 5! + 5! = 120 + 120 = 240 Since 55 is not equal to 240 It is not a Peterson number.
We will pick each digit (Starting from the last digit) of the given number and find its factorial. And add all factorials. Finally, we check if the sum of factorials is equal to number or not.
- Program to check whether the given number is Buzz Number or not
- Program to check Strong Number
- Program to check if a given number is Lucky (all digits are different)
- Program to check if a number is Positive, Negative, Odd, Even, Zero
- Program to check Plus Perfect Number
- Recursive program to check if number is palindrome or not
- C program to Check Whether a Number is Positive or Negative or Zero
- Python program to check whether a number is Prime or not
- Program to check the number is Palindrome or not
- Program to check if a number is divisible by any of its digits
- Program to check if a number is divisible by sum of its digits
- Program to check if N is a Hexagonal Number or not
- Program to check if N is a Star Number
- C Program to check whether a number is a Perfect Cube or not
- C program to check whether a given number is even or odd
- Check if a number is a Krishnamurthy Number or not
- Check Whether a number is Duck Number or not
- Check if a number has same number of set and unset bits
- Check if a number is a Mystery Number
- Check if a given number is factorial of any 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 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.