Phantom's Python ChallengeView as PDF
After all the ordeal, Christine decided to save your lives by kissing the Phantom. That was very nice of her. However, the Phantom considers letting Christine leave with Raoul, if and only if you can convince him that your party is worthy. He challenges you to write a program that shows all the primes under a specific number, while marking the twin primes. Easy as it may sound, the Phantom is also an expert programmer: you have to prove yourself to be at least as good as him. In Python, he expects you to write it in one statement. This means, no new lines or semi-colons are allowed. To prevent the cheap way of achieving this, you are also not allowed to use
exec. To make sure he did not save that scarf for nothing, Raoul bribes you with 30 staggering points.
The input will be one line, containing the number , such that .
All the primes smaller than , separated by whitespace, with a
* after every number forming a twin prime with another. A twin prime is defined as a prime number such that or are prime.
If your solution is correct and contains only one statement without
exec, you get 10 points. For full points, your solution must be at most 160 characters long. More accurately, you get points, capped at 30, where is the length of your solution, if it is correct.
2 3* 5* 7* 11* 13* 17* 19* 23 29* 31* 37 41* 43* 47