Sign up

Prime Number

Check primality, view factor breakdowns, and find neighboring primes.

Number Input

Enter an integer to inspect primality and factors.

Primality Status
—

Analysis Breakdown:

Enter values to analyze.

Factors
—
Check if a number is prime and find factors.

About this topic

Primality Test Check if a number has exactly two divisors.

A prime number is a positive integer greater than 1 that cannot be formed by multiplying two smaller positive integers. It has exactly two divisors: 1 and itself.

Key formulas & rules

  • •Must be greater than 1
  • •Only divisible by 1 and itself
  • •2 is the only even prime
  • •1 is neither prime nor composite
  • •Tested via trial division up to √n
  • •There are infinitely many primes

Examples

Input Output Note
2 Prime Smallest prime
4 Composite Divisible by 2
17 Prime No factors up to √17
1 Neither Edge case

Real-world uses

Cryptography (RSA) Hash functions Computing
Prime Factorization Breaking a number down into its prime components.

Every integer greater than 1 can be uniquely represented as a product of prime numbers. This is the Fundamental Theorem of Arithmetic.

Key formulas & rules

  • •Every composite number has a unique prime factorization
  • •Factors are found by dividing by primes
  • •Helps find GCD and LCM
  • •Number of divisors can be calculated from exponents
  • •Used in simplifying fractions

Examples

Input Output Note
12 2² × 3 Prime factors
60 2² × 3 × 5 Prime factors
97 97 Already prime
100 2² × 5² Prime factors

Real-world uses

Cryptanalysis Simplifying algebraic expressions Number theory
Neighboring Primes Finding the closest primes above and below a number.

For any given integer, there is always a prime number larger than it (Euclid's theorem), and a previous prime below it. Finding these neighbors is useful in hashing and prime gap analysis.

Key formulas & rules

  • •Always a next prime for any integer
  • •Previous prime requires n > 2
  • •Gaps between primes vary widely
  • •Twin primes differ by 2 (e.g., 11 and 13)
  • •Large gaps are called 'prime deserts'
  • •Used in dynamic hashing

Examples

Input Output Note
n = 10 Prev: 7, Next: 11 Standard gap
n = 24 Prev: 23, Next: 29 Gap of 6
n = 89 Prev: 83, Next: 97 Gap of 14
n = 2 Prev: None, Next: 3 Start of primes

Real-world uses

Hash table sizing Random number generation Number theory

Modes & formulas

1

Primality Check & Factors

• A prime number is a positive integer greater than 1 that has exactly two positive divisors: 1 and itself. • Enter a number to test its primality. • The calculator lists all factors and identifies the nearest previous and next primes.
n is prime ⇔ no divisor d with 2 ≤ d ≤ √n

A composite number has at least one divisor other than 1 and itself. Checking only up to √n is sufficient — if n = a × b, at least one of a or b must be ≤ √n.

How to use it

Enter a positive integer and click Calculate. The tool shows primality status, all factors, and the previous and next prime numbers.

Frequently asked questions

Is 1 a prime number?
No. By definition, a prime must have exactly two distinct divisors. The number 1 has only one divisor (itself).
Is 2 a prime number?
Yes, 2 is the smallest and only even prime number.
What is a prime number?
A whole number greater than 1 that has exactly two divisors: 1 and itself.
What is a composite number?
A positive integer greater than 1 that has at least one divisor other than 1 and itself (e.g., 4, 6, 9, 10).
What are twin primes?
Two prime numbers that are exactly 2 apart, such as 11 and 13, or 17 and 19.
What is a Mersenne prime?
A prime number that can be written as 2^n - 1 (e.g., 3, 7, 31). They are the largest known primes.

Related calculators

Read the full Prime Number guide — examples & 18 FAQs