(This article was originally published at R – Xi'an's Og, and syndicated at StatsBlogs.)
An arithmetic Le Monde mathematical puzzle:
A magical integer m is such that the remainder of the division of any prime number p by m is either a prime number or 1. What is the unique magical integer between 25 and 100? And is there any less than 25?
The question is dead easy to code
primz=c(1,generate_primes(2,1e6)) for (y in 25:10000) if (min((primz[primz>y]%%y)%in%primz)==1) print(y)
and return m=30 as the only solution. Bon sang but of course!, since 30=2x3x5… (Actually, the result follows by dividing the quotient of the division of a prime number by 2 by 3 and then the resulting quotient by 5: all possible cases produce a remainder that is a prime number.) For the second question, the same code returns 2,3,4,6,8,12,18,24 as further solutions. There is no solution beyond 30.
Please comment on the article here: R – Xi'an's Og
