Skip to main content

Challenge 191: Prime Reasoning

Can you come up with an efficient solution to Dr Reasoner's prime puzzle?

Dr Reasoner (see challenges 160 and 173) has come up with a prime puzzle to promote logical thinking: If n is a positive integer, and all of nn2 + 1 and n3 + are prime, what is the value of n?

She thinks it is possible to write a good solution to the puzzle in only a couple of lines. Is she right? Can you come up with such a solution?