Check if any number is prime, find its smallest prime factor, and count its total number of factors.
The Prime Number Calculator tells you instantly whether any number is prime, finds its smallest prime factor (for composite numbers), and counts the total number of factors. Prime numbers are the building blocks of all integers — understanding them is fundamental to mathematics, cryptography, and computer science.
What is a Prime Number?
A prime number is a natural number greater than 1 that has exactly two factors: 1 and itself. Examples: 2, 3, 5, 7, 11, 13, 17, 19, 23...
Composite numbers (non-prime) have more than two factors: 4 = 2×2, 6 = 2×3, 12 = 2×2×3
1 is neither prime nor composite. 2 is the only even prime number.
Applications
- Cryptography: RSA encryption (securing websites, banking) relies on the difficulty of factoring large prime numbers. Modern encryption uses primes with hundreds of digits.
- Computer science: Hash functions, random number generation
- Mathematics: Number theory, proofs, competitive olympiad problems
- School exams: Prime factorization, HCF/LCM, divisibility — all fundamental to school math
Prime Factorization
Every composite number can be written uniquely as a product of primes (Fundamental Theorem of Arithmetic). This is the basis for HCF and LCM calculations.
1. Enter Number: Type any positive integer.
2. View Results: See if it's prime (1=yes, 0=no), its smallest prime factor (same as the number if prime), and the total count of its factors.
Primality Test: Check if n is divisible by any integer from 2 to √n. If no divisors found, n is prime. (√n suffices because if n has a factor > √n, the corresponding cofactor < √n would have been found already.)
Smallest Prime Factor: The first prime p that divides n evenly.
Number of Factors: Count all integers from 1 to n that divide n evenly.
Example 1: n = 97 → Prime ✓ (not divisible by 2,3,5,7 and √97 < 10). Factors: 2 (just 1 and 97).
Example 2: n = 84 → Not prime. Smallest prime factor = 2. Factors: 1,2,3,4,6,7,12,14,21,28,42,84 = 12 factors.
Example 3: n = 1 → Neither prime nor composite. Factors: 1 (just itself).