Find the LAST Prime NumberJuly 3 2014 at 12:42 PM
|Al Gore Rhythm (no login)|
It is easy to see that there are an infinite number of prime numbers, so there is no last prime with respect to the usual ordering 2,3,5,7, &c.
BUT..... We can order the prime numbers in alphabetical order according to their name in English (ignoring spaces and hyphens).
So "three" comes before "twenty-three" which comes before "two".
What is the *last* prime number in alphabetical order?
The names of the powers of ten are:
hundred, thousand, million, billion (10**9), trillion, quadrillion, quintillion, ..., decillion, undecellion, dodecillion, tredecillion, quattordecillion, ... vigintillion (10**63)
So the last prime should be close to two 2 x 10**63. (So you will need arbitrary precision math unless you want to use a list of prime numbers from the Internet).
You can use a probalistic primality test like Fermat's test.