Page 1 of 1

12065 - Permutation Primes

Posted: Tue Dec 03, 2013 11:50 am
by groovyfeng
Solution is straight-forward: prime enumeration + permutation generation, but needs to be very careful on the wording of the problem:
1. It says |p-q|<=1000, which means that a pair (p,q), where p>q, is a legitimate input.
2. It defines a permutation prime as a number whose difference with one or more of its permutations is of the form 9p, where p is a prime less than 1111111. It implies that if p is >= 1111111, then the number is not a permutation prime, which sounds a bit strange (although it simplifies the problem a little).