One could check whether some number greater than 1 is prime by trying to divide it by other numbers. If this number is prime, its only exact divisors will be itself and unity.
A much faster way to check a bunch of positive numbers is by sifting out multiples of the small primes. The numbers that are left that are greater than 1 and less than the square of the next prime not yet used for sifting are primes. This technique is called the "sieve of Eratosthenes."
Let us write down the first few positive numbers without doing any sifting.
I have marked the squares (1*1 and 2*2) with partial square buckets. Since the number 1 is a unit and a square, it is not a prime.
The number 2 is our first prime, and since 3 is less than the square of 2 = 4, it is also prime. We don't have any information about 5, 6, and 7 yet.
Now let's sift out the multiples of 2 in order to find the primes less than the square of 3 = 9.
Since 5 and 7 are odd, they do not have a subscript marking them divisible by 2, so we know they are primes.
Now let's also sift out the multiples of 3 and 5 in order to find the primes less than the square of 7 = 49.
Now after sifting with just the first three primes (2, 3, and 5), we have identified all of the 15 primes less than 49 as 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and 47.
There are many other good demonstrations of the sieve of Eratosthenes around the web.