- Practice
- Mathematics
- Number Theory
- Identify Smith Numbers

# Identify Smith Numbers

# Identify Smith Numbers

A *Smith number* is a composite number, the sum of whose digits is the sum of the digits of its prime factors obtained as a result of prime factorization (excluding ). The first few such numbers are , , , , , , and .

**Example:**

So, its prime factors are , , , , and .

The sum of its digits is .

The sum of the digits of its factors is .

Similarly, is a Smith number.

, and the sum of its digits is the same as the sum of the digits of its prime factors: .

**Task:**

Write a program to check whether a given integer is a Smith number.

**Input Format**

There will be only one line of input: , the number which needs to be checked.

**Constraints**:

*(max value of an integer of the size of bytes)*

**Output Format**

if the number is a Smith number.

if the number is a not Smith number.

**Sample Input**

378

**Sample Output**

1

**Explanation**

Its prime factors are , , , , and .

The sum of its digits is .

The sum of the digits of its factors is .