Given a list, write a Python program to print all the strong numbers in that list.
Strong Numbers are the numbers whose sum of factorial of digits is equal to the original number.
Example for checking if number is Strong Number or not.
Input: n = 145 Output: Yes Explanation: Sum of digit factorials = 1! + 4! + 5! = 1 + 24 + 120 = 145
Steps for checking number is strong or not :
1) Initialize sum of factorials as 0. 2) For every digit d, do following a) Add d! to sum of factorials. 3) If sum factorials is same as given number, return true. 4) Else return false.
Let’s see the Python program for this problem :
145 2 40585 0
- Python program to find all Strong Numbers in given list
- Python program to print odd numbers in a List
- Python program to print even numbers in a list
- Python program to print negative numbers in a list
- Python program to print positive numbers in a list
- Python Program to Print Numbers in an Interval
- Python program to print all odd numbers in a range
- Python program to print all even numbers in a range
- Python | Program to print duplicates from a list of integers
- Python program to print all negative numbers in a range
- Python program to print all Prime numbers in an Interval
- Python program to print all positive numbers in a range
- Python program to count Even and Odd numbers in a List
- Python program to count positive and negative numbers in a list
- Generating Strong Password using Python
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.