#C14472. Number Analyzer
Number Analyzer
Number Analyzer
In this problem, you are given a list of integers. For each integer, you need to determine three properties:
-
Whether it is a prime number. Recall that a number ( n ) is prime if ( n > 1 ) and it has no positive divisors other than 1 and itself.
-
Whether it is a perfect square. A number ( n ) is a perfect square if there exists an integer ( k ) such that ( k^2 = n ); note that negative numbers are not considered perfect squares.
-
Its factorial value, defined as ( n! ) for non-negative integers ( n ). If ( n ) is negative, the factorial is undefined and you should output
None
.
Your program should read input from standard input and write the results to standard output. For each integer provided, output a single line containing the integer itself, followed by its prime status, perfect square status, and the factorial (or None if undefined), each separated by a space.
inputFormat
The first line of input contains an integer ( T ) representing the number of integers. The second line contains ( T ) space-separated integers.
outputFormat
For each integer, print a line with four values separated by a space:
- The integer itself
True
orFalse
indicating if the integer is primeTrue
orFalse
indicating if the integer is a perfect square- The factorial of the integer if it is non-negative; otherwise, output
None
## sample
5
2 4 5 -1 0
2 True False 2
4 False True 24
5 True False 120
-1 False False None
0 False True 1
</p>