in reply to is_a_prime test?
What made you believe that the program hang? One thing is for sure that, the program will run for quite a while before it finally figures out that 429496731 is a prime.
You don't need to test every integer that is smaller than the input number. You only need to try up to its sqrt(). (You can further improve this, but what I suggested here is an easy fix to the situation with the least amount of effort.)
|
|---|