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
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python program to find all Strong Numbers in given list
- Generating Strong Password using Python
- Categorize Password as Strong or Weak using Regex in Python
- Python Program for Efficient program to print all prime factors of a given number
- Python program to print odd numbers in a List
- Python program to print even numbers in a list
- Python program to print positive numbers in a list
- Python program to print negative numbers in a list
- Program to print all the numbers divisible by 3 and 5 for a given number
- Program to print all the numbers divisible by 5 or 7 for a given number
- 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 even numbers in a range
- Python program to print all odd numbers in a range
- Python program to print all positive numbers in a range
- Python | Print all string combination from given numbers
- Python program to create a list of tuples from given list having number and its cube in each tuple
- Program to print all distinct elements of a given integer array in Python | Ordered Dictionary
- Python Program to print all permutations of a given string
- Python program to find all the Combinations in the list with the given condition
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.