It should also be noted that if I change the isProbablePrime method to use the RabinMillerTest instead of the SmallPrimeSppTest, everything works perfectly. So it appears to be a bug in the SmallPrimeSppTest method. Regards, Pieter Philippaerts