#K77542. Prime Number Checker
Prime Number Checker
Prime Number Checker
You are given a single input from stdin that represents a value. Your task is to determine whether the given value (if it is an integer) is a prime number.
For the purposes of this problem, a prime number is defined as an integer \( n \) such that \( n \ge 2 \) and the only divisors of \( n \) are 1 and \( n \) itself. If the input is not a valid integer, you should output None
(without quotes). Note that numbers less than 2 are not considered prime.
Examples:
- Input:
2
→ Output:True
- Input:
4
→ Output:False
- Input:
abc
→ Output:None
True
if the input represents a prime number.False
if the input is an integer but not a prime number (including when it is less than 2).None
if the input does not represent a valid integer.
inputFormat
The input consists of a single line read from stdin. The line contains either an integer (possibly with a leading + or - sign) or a non-integer string.
outputFormat
Print one of the following outputs to stdout:
2
True