Prime Number Calculator

Test a whole number for primality and meet its neighbouring primes.

A whole number from 1 to 1 000 000 000 000

Try

Result

You enteredn=97n = 97

97 is prime\displaystyle \text{97 is prime}

Next prime

101\displaystyle 101

Previous prime

89\displaystyle 89
Show the work
  1. Test divisors up to the square root

    If 9797 had a factor larger than its square root, it would be paired with a smaller one, so it is enough to test the primes up to it, 22, 33, 55 and 77. None of them divides 9797 exactly.

    ⌊97⌋=9\lfloor\sqrt{97}\rfloor = 9
  2. Result

    So 9797 is prime: its only factors are 11 and 9797.

Worked examples