# Is this prime?

This site has one job: to tell you whether a given number is prime or not.

If you go to, for example, isthisprime.com/57, it will tell you that 57 is not a prime number.

## How it works

For numbers up to 10 digits long, it uses the deterministic Miller test to determine if the number is prime, with 100% certainty. This is a remarkably clever algorithm which can decide primality in logarithmic time.

For larger numbers, it uses the probabilistic Miller-Rabin test to make a pretty good guess about whether the given number is prime. "Pretty good" in this case means "practically certain" - you're very unlikely to type in a number which the algorithm says is probably prime but which is in fact composite. However, when the algorithm says a number is composite, it's definitely composite.

For numbers up to 25 digits long, the Miller-Rabin test can give definite answers for primes up to about 25 digits long, by using a set of "witness" bases.

If I was cleverer, I'd pay more attention to the intricacies of these tests to make them run faster and be more certain, but I'm already at the edge of my understanding.

## Extras

You can turn on screensaver mode by adding `?screensaver` to the end of the URL, e.g. isthisprime.com/57?screensaver. It'll automatically move on to the next number every 5 seconds.

You can have it show the current UNIX timestamp (the number of seconds since new year, 1970) by going to isthisprime.com/now.

If you would rather decide what's prime and what's not, try the Is this prime? game.