## Smith Number Description :

A number is said to be a smith number if sum of digits of the number is equal to the sum of the digits of its prime factors (excluding 1).

We have to find factors using prime factorization method

For example if we consider number = 666

sum of digits : 6 + 6 + 6 = 18

prime factors are : 2, 3, 3, 37
now sum of prime factors = (2+3+3+(3+7)) = 18

Hence 666 is a Smith Number

## Python program implementation :

#### Method 1 :

```				```
n = int(input("Enter Number : "))

sd=0
sf=0
temp=n

while temp>0:
sd = sd+(temp%10)
temp = temp // 10

# calculation the sum of the factors
temp = n
while temp > 1:
i = 2
for i in range(2,temp+1):
if temp%i==0:
break
# check if the factor is prime number
c = 0
t = i
for j in range(1,i+1):
if i%j==0:
c+=1
#adding the digits of the prime factors
if c==2:
while i>0:
sf = sf+(i%10)
i = i//10
temp = temp//t
if sd==sf:
print("Smith number")
else:
print("Not a Smith number")
```
```

#### Method 2 :

```				```
import math
def Get_factor(n):
l=[]

while n%2==0:
l.append(str(2))
n=n//2
for i in range(3,int(math.sqrt(n))+1,2):
while n%i==0:
l.append(str(i))
n=n//i

if n>2:
l.append(str(n))
ans=[]
for i in l:
ans.extend(list(i))

return sum(list(map(lambda i:int(i),ans)))
def check_smith(n):
s = sum(map(lambda x:int(x),n))
if s==Get_factor(int(n)):
print('Smith number')

else:
print('Not a smith number')
n=input("Enter number : ")
check_smith(n)
```
```