Quicker Prime Number Test [Tip/Trick]
Posted: 4 Nov 2011
Updated: 6 Nov 2011
Rating: 4.88/5
Votes: 5
Popularity: 3.49
Licence: The Code Project Open License (CPOL)
Bookmarked: 0
Downloaded: 33
When you search manually, you can search for every odd number that is a step of 2. If you're a bit more clever (as you are), you can use steps of 6 (2 * 3). Testing (testno+1)%6==0 is very similar to (testno % 6) = 5.You can speed up big time by having a loop that increments per steps of...