How do you go about finding a 12 digit prime number?

1.2k Views Asked by At

How do you go about finding a 12 digit prime number?

4

There are 4 best solutions below

0
On

100 000 000 003 is one. 100 000 000 019 is another.

If you want an algorithm, you can look at number sieves (or this general article on generating prime numbers).

2
On

The best way to do this is to repeatedly generate a random 12-digit number then test it for primality. Fortunately, there is a deterministic procedure to test primality that has been proven to work for all primes $p < 341,550,071,728,321$, see this useful site.

3
On

Another nice example is $p=2^{39}-7$. It is equal to $549.755.813.881$, which has $12$ digits. And indeed $p$ is prime.

0
On

With PARI/GP:

randomprime(10^11, 10^12)

which you can see is just generating and testing random numbers in the appropriate range.