2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, ...
For example, 5 is a prime number because you can divide 5 by 1 evenly and divide 5 by 5 without a remainder, but if you divide 5 by any other integer, you get a remainder.
5/1 = 5
5/2 = 2 plus a remainder
5/3 = 1 plus a remainder
5/4 = 1 plus a remainder
5/5 = 1
5/6 = 0 plus a remainder
... = 0 plus a remainder
Now look at the number 4 which is not a prime.
4/1 = 4
4/2 = 2
4/3 = 1 plus a remainder
4/4 = 1
4/5 = 0 plus a remainder
... = 0 plus a remainder
The number 4 can be divided by 2 evenly, so it is not a prime.
The flowchart shown above describes a function that is given a number i and returns whether it is prime or not. The name of the function is "IsThisNumberPrime." First it checks to make sure the input number is an integer. Then it checks to make sure the input number is not negative, 0 , or 1. Negative integers, 0, and 1 are not considered prime by definition.
Next the function tries to divide the input number by i, where i = 2, 3, 4, 5, and so forth, to see if it divides any of them evenly, that is, without a remainder. If the input number is divided evenly, it is not a prime. The check stops when i is equal to the input number.
You give the function a number and the output is "Yes" if the number is prime, or "No" if it is not.
Now suppose you want to calculate the first 100 prime numbers. A flowchart to show that process is shown below.
The first few primes are quickly calculated, but as the primes get further apart the computation time increases. Finding large primes is a task for super computers.