The method you describe for testing primes is a variation trial division. For small numbers, under a billion, trial division works well. But high end applications like modern cryptography use numbers which can be a thousand *digits* long. Trial division could take the lifetime of the universe to check if a number is prime, which is why much more sophisticated methods are used to test large numbers in practice.
No comments:
Post a Comment