Factorial Number
Submissions: 1606   Accuracy:

36.36%

  Difficulty: Basic   Marks: 1

For a given number n, find whether it is a factorial number or not. A Factorial number is a number which is equal to factorial value of another numbers.  For example 6 is factorial number because it is factorial of 3 and 5 is not a factorial number.

Input:
First line contains an integer, the number of test cases 'T' Each test case should contain a positive integer N.


Output:
Print "1" if it is a factorial number else print "0".


Constraints:
1<=T<=20000
1 <= N <=100000


Example:
Input:
2
6
5

Output:
1
0

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

Author: kartik


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.