How to quickly check if a number is prime?

851 Views Asked by At

Let say I've found a very very very long prime number. I know it's prime but I need to have a proof. Is there any fast way how to check if a number is really prime?

Let say I've found the longest prime number, longer than the longest known and I want to confirm it in very short time (seconds). Is it possible?

2

There are 2 best solutions below

1
On

I guess the Fastest method known till date is - AKS Primality Test

However it won't be able to find the longest prime number within seconds.

1
On

If the number is of general form, fastest would be one of the modern versions of ECPP. This is several orders of magnitude faster than AKS.

If you can tolerate a tiny probability of error, the Miller-Rabin test works very well here.

If you can tolerate error, but only infinitesimally small, the Frobenius tests can provide much better worst-case error bounds than Miller-Rabin.

If the number is of special form the Lucas test or its variants might be applicable.