Prime Number Checker

Enter a whole number to see whether it is prime. If it is not, you get its prime factorization and every divisor. The nearest primes above and below are shown either way.

-

Previous prime
-
Next prime
-
Divisors
-
Sum of divisors
-

All divisors

Prime numbers up to 1,000

There are 168 of them.

2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997

What makes a number prime

A prime is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. Every other whole number above 1 is composite and can be written as a product of primes in exactly one way, the fundamental theorem of arithmetic: 2026 = 2 × 1013, and 360 = 2³ × 3² × 5. The number 1 is neither prime nor composite, and 2 is the only even prime.

How to test by hand

To test n, try dividing by every prime up to √n. If none divides evenly, n is prime. For 97, √97 ≈ 9.8, so only 2, 3, 5 and 7 need checking, and none divides 97. This calculator uses the same trial division, which is exact and fast up to about 16 digits.

Facts about primes

Euclid proved around 300 BC that there are infinitely many primes. They thin out as numbers grow: about 1 in 7 numbers below 1,000 is prime, about 1 in 23 below a billion. Large primes secure the internet: RSA encryption relies on the fact that multiplying two large primes is easy, while factoring the product back is practically impossible.