| ▲ | Nevermark 15 hours ago | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
Just grab some paper, a pen, and check that no number equal or smaller than its square root divides into it evenly. That is it. That is all. Pish posh. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | WCSTombs 15 hours ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The example given in the article is 2^127 - 1, which was historically proved to be prime without computers using a clever method now known as the Lucas-Lehmer test. Your algorithm is not practical for that number. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | tmtvl 4 hours ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
Even better: you only have to check primes smaller than or equal to the square root. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||