You don't need to remember them; there are an infinite number of them! But if you wanted to recognise them up to 1000, for example, you only have to test for divisibility by prime numbers up to 29: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, that's only 10 numbers to remember! If a number from 30 to 1000 needs to be tested, you only need to know if one or more of those ten primes goes into it. If none of them do, the number is prime.