Given a natural number as input, your task is to output a truthy or falsey value based on whether the input is a factorial of any natural number. You can assume that the input number will always be in the range of numbers supported by your language, but you must not abuse native number types to trivialize the problem.
Standard Loopholes apply.
You'll be given a natural number (of type
Integer or similar).
You can take input in any way you want except assuming it to be in a predefined variable. Reading from file, console, dialog box (
prompt), input box etc. is allowed. Input as function argument is allowed as well!
Your program should output a truthy or falsey value based on whether the input number is a factorial of any natural number.
Make sure that your truthy/falsey values are consistent for all inputs, i.e, if you are using pair of 1 and 0 to denote truthy and falsey values respectively, then your program must output 1 for all inputs that should have truthy values and 0 for all inputs that should have falsey values.
You can take output in any way you want except writing it to a variable. Writing to file, console, screen etc. is allowed. Function
return is allowed as well!
Your program must not produce errors for any input!
Input Output 1 Truthy (0! or 1!) 2 Truthy (2!) 3 Falsey 4 Falsey 5 Falsey 6 Truthy (3!) 7 Falsey 8 Falsey 24 Truthy (4!) 120 Truthy (5!)
This is code-golf, so the shortest code in bytes wins!