Lookup and Inquiry For All Prime Numbers Up To 100000000000000
A whole number (integer) greater than one is called a "prime number" if it has no positive divisors other than itself and one.
For example, the first few prime numbers are 2, 3, 5, 7, 11. All prime numbers greater than two are odd numbers for the simple reason that all other integers greater than two are divisible
by the first prime number, which is 2. All prime numbers greater than three are of the form of either 6n - 1 or 6n + 1 where n is a positive integer.
This is because all the rest of the integers must be of the form 6n or 6n + 2 or 6n + 4 (which are divisible by 2), or 6n + 3
(which is divisible by 3), and because 6n + 5 can be written as 6m - 1 where m is equal to n + 1.
There are infinitely many prime numbers, a fact that can be verified by the simple proof that, if we assume that there were a finite list of numbers p1, p2, p3... pn that were all of the prime numbers, then we find that the number q1 = p1 times p2 times p3 ... times pn + 1 is not equal to any number from our list of all primes and is not divisible by any number from our list of primes. Thus we are led to the contradiction that q1 is also a prime but is not in our list of all of the primes. The contradiction can only be because we made an error in assuming that our (finite) list of primes included all primes.
The simplest way to determine what whole numbers between m and n are prime numbers is to check each number "p" in turn to see if it is divisible by any prime number determined thus far in our process. In fact, we need only check prime numbers less than or equal the square root of p because if p is not prime then p = m times n where either m or n is less than or equal the square root of p. This method of determining prime numbers is called the "Sieve of Eratosthenes".
The method used here to determine these primes is the classic "Sieve of Eratosthenes" approach. Since addition is generally quicker than division on a computer, the approach used is to start with a list of all numbers between m and n and then cross out (mark as not a prime) the multiples of numbers from a complete list of primes which are smaller than the square root of n. The numbers left after all this crossing-out represent the prime numbers between m and n. Test this number and look up a list of primes close to it: