# Prime Number Calculator

Check if any number is prime, find its prime factorization, list all divisors, and find the nearest primes. Free online prime number checker.

## What this calculates

Check whether any number is prime, see its complete prime factorization, get a list of all divisors, and find the nearest primes above and below it.

## Inputs

- **Number to Check** — min 1 — Enter a positive integer to check for primality.

## Outputs

- **Is Prime?** — formatted as text — Whether the number is a prime number.
- **Prime Factorization** — formatted as text — The number expressed as a product of primes (if composite).
- **All Divisors** — formatted as text — Complete list of positive divisors.
- **Number of Divisors** — Total count of positive divisors.
- **Nearest Primes** — formatted as text — The closest prime below and above the input.

## Details

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The first few primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29.

**How to Test for Primality:**

To check if a number n is prime, you only need to test divisors up to sqrt(n). If none of them divide n evenly, the number is prime. This works because if n = a x b, at least one of a or b must be less than or equal to sqrt(n).

**Composite Numbers:**

A composite number has more than two divisors. Every composite number can be written as a unique product of primes (the Fundamental Theorem of Arithmetic). For example, 60 = 2^2 x 3 x 5.

**Special Facts About Primes:**

- 2 is the only even prime number
- 1 is neither prime nor composite
- There are infinitely many primes (proven by Euclid around 300 BC)
- The largest known primes are Mersenne primes, found using distributed computing
- Prime numbers are the foundation of modern cryptography (RSA encryption)

## Frequently Asked Questions

**Q: Is 1 a prime number?**

A: No. By definition, a prime number must have exactly two distinct positive divisors: 1 and itself. The number 1 has only one divisor (itself). Excluding 1 from the primes ensures that the Fundamental Theorem of Arithmetic (unique prime factorization) holds without ambiguity.

**Q: Why is 2 the only even prime?**

A: 2 is prime because its only divisors are 1 and 2. Every other even number is divisible by 2, which means it has at least three divisors (1, 2, and itself), so it cannot be prime. This makes 2 unique as the only even prime and the smallest prime number.

**Q: How can I quickly check if a large number is prime?**

A: For numbers up to a few million, trial division up to the square root works well. For very large numbers, probabilistic tests like Miller-Rabin are much faster. This calculator uses trial division, which is exact and works well for numbers up to about 10 billion.

**Q: Are there infinitely many prime numbers?**

A: Yes. Euclid proved this around 300 BC with a clever argument by contradiction: assume there are finitely many primes, multiply them all together and add 1. The resulting number is not divisible by any prime on the list, so either it is a new prime or it has a prime factor not on the list. Either way, the assumption is contradicted.

---

Source: https://vastcalc.com/calculators/math/prime-number
Category: Math
Last updated: 2026-04-08
