DWITE Online Computer Programming Contest, March 2010, Problem 2
More from the series of round to closest obscure function — round to the closest second prime. That is, "round" an integer to a closest prime number such that there is exactly one other prime number between the original input and the result. If the input integer itself is a prime, it is still rounded (the requirement of having a prime in between). If there are two primes equally far away that both satisfy the condition, then the larger one is the answer.
The input will contain 5 lines, integers
The output will contain 5 lines, integer answers to corresponding lines of input.
Example: input is 7 (which incidentally is a prime). The two primes around it are 5 and 11. The two second primes around that are 3 and 13. 3 is closer to 7 than 13 is, so .
5 6 7 8 9
2 3 3 5 13