Fastest algorithm for primality test

dada picture dada · Apr 6, 2010 · Viewed 36.7k times · Source

I need to test primality on intervals between numbers which are really big (in the range of long long), so i need some fast algorithm for checking if a number is prime or not. Please suggest your ideas.

Answer

cobbal picture cobbal · Apr 6, 2010

One good method is the Miller-Rabin test. It should be noted however, that this is only a probabilistic test.