Skip to main content
🔢 Number Theory

Prime Number Calculator

Check whether a whole number is prime, get its prime factorization with exponents, count its divisors, and find the next prime above it — with the method shown.

Prime check
Prime factorization
Divisor count
Next prime
100% Free
🔢 Open All Math Calculators 📖 Read the Guide

Prime numbers — Quick answer

A prime has exactly two divisors: 1 and itself. Everything else above 1 is composite.

prime ⇒ divisors {1, n}  ·  test factors up to √n  ·  1 = neither

Worked example: 97 is prime · 100 = 2² × 5² (9 divisors) · next prime after 100 is 101.

Prime check examples

NumberPrime?Factorization
17Yes17 (prime)
97Yes97 (prime)
100No2² × 5²
360No2³ × 3² × 5

2 is the only even prime; 1 is neither prime nor composite.

🔢 Prime Number Calculator

Enter a whole number (2 or greater works best). The check uses trial division up to √n.

Is it prime?
Prime factorization
Number of divisors
Next prime

ℹ️ A prime has exactly two divisors (1 and itself). 1 is neither prime nor composite; 2 is the only even prime.

A prime number is a whole number greater than 1 whose only divisors are 1 and itself — 2, 3, 5, 7, 11, 13, … Any other number above 1 is composite and can be broken into a unique product of primes. This calculator tests primality by trial division up to √n, then gives the prime factorization, the total number of divisors, and the next prime above your number.

Reviewed: June 20, 2026 · Author: Naveen P N, Founder — AI Calculator · Verified against: trial-division primality and the fundamental theorem of arithmetic, recomputed in code.

How the check works

Prime test
no factor from 2 to √n divides n ⇒ prime
Factorization
n = p₁^a · p₂^b · … (unique)
Divisor count
(a+1)(b+1)… from the exponents

To test a number you only need trial divisors up to its square root: any factor above √n must pair with one below it, so if none below works, none above does either. Once you have the prime factorization, the number of divisors falls out by adding one to each exponent and multiplying — for 100 = 2²·5² that's (2+1)(2+1) = 9. Every integer above 1 has exactly one prime factorization, the fundamental theorem of arithmetic.

Worked example — 97 and 100

Scenario: one prime and one composite.

97
nothing from 2 to √97 ≈ 9.8 divides it ⇒ prime
100
100 = 2 × 2 × 5 × 5 = 2² × 5²
Divisors of 100
(2+1)(2+1) = 9 divisors

97 survives every trial divisor up to 9, so it's prime — with exactly 2 divisors and a next prime of 101. 100 factors as 2² × 5², giving 9 divisors (1, 2, 4, 5, 10, 20, 25, 50, 100) and a next prime of 101 as well. A bigger composite, 360, factors as 2³ × 3² × 5 with (3+1)(2+1)(1+1) = 24 divisors.

Frequently Asked Questions

What is a prime number?

A whole number > 1 with exactly two divisors, 1 and itself: 2, 3, 5, 7, 11, 13… 2 is the only even prime.

How do you check if a number is prime?

Trial division: if nothing from 2 to √n divides it, it's prime. 97 has no factor up to ≈9.8, so it's prime.

Is 1 a prime number?

No — 1 is neither prime nor composite. A prime needs exactly two divisors; 1 has only one.

What is prime factorization?

Writing a number as a product of primes: 100 = 2² × 5², 360 = 2³ × 3² × 5. Each number has exactly one such form.

What is the next prime after a number?

The smallest prime above it. After 100 → 101; after 17 → 19. Primes are infinite (Euclid).

Need more math tools?

Explore GCD/LCM, factorial, fractions, exponents and more across the AI Calculator math suite.

🔢 Open Math Calculators — Free

No registration required · 350+ calculators · PDF report export