 Timer is Running

Sphenic Number
##### Submissions: 1847   Accuracy: 39.38%   Difficulty: Easy   Marks: 2

Sphenic Number is a positive integer N which is product of exactly three distinct primes. The first few sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114, …
Given a number N, your task is to find whether it is a Sphenic Number or not.

Examples:

```Input : 30
Output : 1
Explanation : 30 is the smallest Sphenic number,
30 = 2 × 3 × 5
the product of the smallest three primes

Input : 60
Output : 0
Explanation : 60 = 22 x 3 x 5
has exactly 3 prime factors but
is not a sphenic number```

Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each line contains an integer N.

Output:
For each test case in a new line print 1 if N is a Sphenic Number else print 0.

Constraints:
1<=T<=100
1<=N<=1000

Example:
Input:

2
30
60
Output:
1
0

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

Author: Shubham Joshi 1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.