# What is the first 21-digit prime number after the decimal point of Pi

We know the recent computers are 64-bit, and the maximum integer number is 18446744073709551615, whether you can find the first 21-digit prime number after the decimal point of $\pi$?

-
You mean if we can find the first 21-digit prime in the decimal representation of $\pi$? What is that supposed to have to do with 64bit computers? –  CBenni Jan 24 '13 at 17:58
Notice that the number size is out of the range of the maximum computer integer number. –  hjin15 Jan 24 '13 at 18:02
There are many ways to represent numbers in computers. You are right you can't put a 21 decimal digit number into a 64 bit register, but Alpha, Maple, Python, and many others have the ability to handle larger integers. –  Ross Millikan Jan 24 '13 at 18:13

You can certainly start taking the batches of $21$ decimals and check them for primality. You start with $141592653589793238462$ which is clearly not prime as it is even. The first odd batch is $592653589793238462643=7^2×11×17203×624683×102317113$. One would expect about one in $45$ numbers of this size to be prime, so you shouldn't have to look far. You can check your favorite with Alpha

The first one I find is $338327950288419716939$, checked with Alpha. Alpha is able to fully factor numbers of this size quickly.

-

What you are looking for is sometimes called an infinite precision math library that allows you to extend the size of your numbers beyond the maximum representable by the word size of your CPU.

Sometimes this is called an arbitrary precision library.

Languages like Java, and say Python provide such capabilities. Computer Algebra Systems like Mathematica (as does WolframAlpha), Maple, Maxima and Gp/PARI have this capability built in.

This and the answer by Ross should get you moving forward.

You also need to decide on a primality test to use against your numbers and that should be something like Miller-Rabin followed by Lucas or other choices too depending on your needs.

Regards.

-
Just wanted to reinforce this by pointing out that $2^{2281}-1$, a 687-digit prime, was already found 60 years ago by a computer having less than 10 kilobits of RAM (in the form of vacuum tubes). Today, there's probably more computing power inside a \$5 pedometer, let alone a 64-bit computer. –  Erick Wong Jan 24 '13 at 18:26
@ErickWong: Eric, thanks for the tidbit, I actually wasn't aware that they had done such a large prime at that time. Do you have a reference for this? I recall the good old days when we had to be so careful with using the very limited resources we had and were forced to do efficient things. Regards –  Amzoti Jan 24 '13 at 19:00
Apparently the specific announcement was published by Lehmer as an followup note in Mathematics of Computation (AMS link). For the capacity of the computer (named SWAC) I just looked up Wikipedia. –  Erick Wong Jan 24 '13 at 19:58
Nice, Amzoti! +1 –  amWhy May 6 '13 at 2:03