In this Python Program, we will learn how to find the strong number using the ** factorial()** function.

A **Strong Number** is a number in which the sum of the factorial of individual digits of that number is equal to the original number. For examples : 1, 2, 145, 40585, etc.

Now take a look at that example, we have a number 145 and its digits are 1, 4, and 5.

Now we find the factorial of each digit as we do

1! = 1 = 1

4! = 4*3*2*1 = 24

5! = 5*4*3*2*1 = 120

Now their sum = 120 + 24 + 1 = 145 which is equal to the Original Number.

Hence We can Say that 145 is a Strong Number.

In this program, we used

function which imports from the **math.factorial()****math** module.

Here is the source code of the program to find a strong number using the

function.**factorial()**

```
# Python Program to find Strong Number using factorial function
# Import Module
import math
# Take input From the User
Number = int(input("Enter any Number: "))
Sum = 0
Temp = Number
while(Temp > 0):
Reminder = Temp % 10
Factorial = math.factorial(Reminder)
print("Factorial of %d = %d" %(Reminder, Factorial))
Sum = Sum + Factorial
Temp = Temp // 10
print("\nSum of Factorials of a Given Number %d = %d" %(Number, Sum))
if (Sum == Number):
print("%d is a Strong Number" %Number)
else:
print("%d is not a Strong Number" %Number)
```

Enter any Number: 145

Factorial of 5 = 120

Factorial of 4 = 24

Factorial of 1 = 1

Sum of Factorials of a Given Number 145 = 145

145 is a Strong Number

Enter any Number: 524

Factorial of 4 = 24

Factorial of 2 = 2

Factorial of 5 = 120

Sum of Factorials of a Given Number 524 = 146

524 is not a Strong Number

## Comments