When Dr. Orooji was your age, one of the popular TV shows was “Get Smart!” The main
character in this show (Maxwell Smart, a secret agent) had a few phrases; we used one such
phrase for the title of this problem and we’ll use couple more in the output!
A “prime” number is an integer greater than 1 with only two divisors: 1 and itself; examples
include 5, 11 and 23. Given a positive integer, you are to print a message indicating whether the
number is a prime or how close it is to a prime.
The first input line contains a positive integer, n (n ≤ 100), indicating the number of values to
check. The values are on the following n input lines, one per line. Each value will be an integer
between 2 and 10,000 (inclusive).
At the beginning of each test case, output “Input value: v” where v is the input value.
Then, on the next output line, print one of the following two messages:
- If the number is a prime, print “Would you believe it; it is a prime!”
- If the number is not a prime, print “Missed it by that much (d)!” where d
shows how close the number is to a prime number (note that the closest prime number
may be smaller or larger than the given number).
Leave a blank line after the output for each test case. Follow the format illustrated in Sample
Input value: 23
Would you believe it; it is a prime!
Input value: 25
Missed it by that much (2)!
Input value: 22
Missed it by that much (1)!
Input value: 10000
Missed it by that much (7)!