First things first-- please use the code tag around your source code. Also, preview is a wonderful idea before creating a post.
How do you know the code is hanging? Consider putting some logic in that will update you every x numbers in the loop. Basic debugging is a good skill to learn, and usually starts with a print. Now consider that you only have to check the numbers up to the square root of the number you are testing for prime, and you only need to check the odds after the number 2.
In reply to Re: is_a_prime test?
by shevek
in thread is_a_prime test?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |