BETA

Submissions: 702 Accuracy: 25.78%

Smith Number

Given a number n, the task is to find out whether this number is smith or not. A Smith Number is a composite number whose sum of digits is equal to the sum of digits in its prime factorization.

Input:

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains the integer N.

Output:

If N is a Smith print 1 else print 0. Output the answer for each test case in a new line.

Constraints:

1<= T <=200

1<= N <=100000

Example:

```Input  : n = 4
Output : 1
Prime factorization = 2, 2  and 2 + 2 = 4
Therefore, 4 is a smith number

Input  : n = 6
Output : 0
Prime factorization = 2, 3  and 2 + 3 is
not 6. Therefore, 6 is a smith number

Input   : n = 666
Output  : 1
Prime factorization = 2, 3, 3, 37 and
2 + 3 + 3 + (3 + 7) = 6 + 6 + 6 = 18
Therefore, 666 is a smith number

Input   : n = 13
Output  : 0
Prime factorization = 13 and 13 = 13,
But 13 is not a smith number as it is not
a composite number```

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sujnesh Mishra

It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result: