Of course, this method requires already having a list of primes up to some point; for instance, in order to test any number less than 10,000, we would need to know all the primes less than 100. For many purposes, that will be reasonable; but not for really big numbers.