- #71
Jarvis323
- 1,243
- 987
Vanadium 50 said:It's not. Your code would claim 13 is not prime because it's divisible by 13.
Can't believe I missed that.
Anyway, it seams like this is a working faster version of that block of code.
C:
if( n > 79 &&
! ( ( ( n % 2 ) ) |
( ( n % 3 ) ) |
( ( n % 5 ) ) |
( ( n % 7 ) ) |
( ( n % 11 ) ) |
( ( n % 13 ) ) |
( ( n % 17 ) ) |
( ( n % 19 ) ) |
( ( n % 23 ) ) |
( ( n % 29 ) ) |
( ( n % 31 ) ) |
( ( n % 37 ) ) |
( ( n % 41 ) ) |
( ( n % 43 ) ) |
( ( n % 47 ) ) |
( ( n % 53 ) ) |
( ( n % 59 ) ) |
( ( n % 61 ) ) |
( ( n % 67 ) ) |
( ( n % 71 ) ) |
( ( n % 73 ) ) |
( ( n % 79 ) ) ) )
{
return false;
}