Hi Jim, In my comment/solution for this Enigma I tried to post a link to my number theory library but my HTML got removed. Could you please replace the first sentence with: A solution using my <a href="http://173.254.28.24/~brgladma/number_theory.py">number theory</a> library: (without the line wrapping). thanks Brian