Source Code for Hacker Rank Online Coding 2014 Question on "Optimal Primes"