Your challenge is to write a Python program to print all the primes (separated by whitespace) less than a given integer N
with an asterisk (*
) next to each twin prime in ONE statement. A twin prime is a prime number that is either two more or two less than another prime.
All output should be to stdout and input should be read from stdin. (Hardcoding outputs is allowed, but it is not likely to result in very short code.)
Shortest code wins!
For the less restricted version of the challenge for all languages, click here.
Input
N
is always one of 50, 100, 1000, 1000000, or 10000000
Output
- Possible output for input
12
could be2 3* 5* 7* 11*
(However, the input will never be 12, as specified above. Your program need not work for this input.)
Restrictions
- No new lines or semicolons
- Do not use eval or exec
for i in []: print(i)
or not? It's technically a compound statement, which contains another one, and it doesn't have any newlines or semicolons... \$\endgroup\$