Python program to print all Strong numbers in given list
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