What is a prime number calculator?
A prime number calculator tells you whether a number is prime or composite and breaks it into prime factors. Enter any whole number and this online prime number checker shows the answer, the prime factorization with steps (division method), the number of divisors, and the nearest prime numbers before and after it. Switch to range mode to list every prime between two numbers, such as all prime numbers from 1 to 100. It is free, fast and handles numbers up to 10¹⁵.
What is a prime number?
A prime number is a whole number greater than 1 that has exactly two factors: 1 and itself. 2, 3, 5, 7, 11 and 13 are prime. A composite number has more than two factors: 12 = 2 × 2 × 3, so it is composite. The numbers 0 and 1 are neither prime nor composite. 2 is the only even prime, because every other even number is divisible by 2. (In Hindi, a prime number is called अभाज्य संख्या, abhajya sankhya, and a composite number भाज्य संख्या.)
How to use this calculator
- To check a prime number, keep “Check a number” selected and type the number. You get prime or composite, the factorization, divisors and nearest primes.
- To list primes, choose “List primes in a range” and enter the start and end, for example 1 and 100. The span can be up to 1,00,000 numbers.
Prime numbers from 1 to 100
There are 25 prime numbers between 1 and 100:
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
| Range | How many primes | Largest prime |
|---|---|---|
| 1–10 | 4 | 7 |
| 1–100 | 25 | 97 |
| 1–1,000 | 168 | 997 |
| 1–10,000 | 1,229 | 9,973 |
| 1–1,00,000 | 9,592 | 99,991 |
The greatest prime number less than 100 is 97. There is no greatest prime overall: Euclid proved more than 2,000 years ago that there are infinitely many primes.
How to find prime numbers: is there a formula?
There is no simple formula that produces every prime. Instead, you test a number for divisibility or sieve out composites. Both methods are exact.
Trial division (checking one number)
- If the number is less than 2, it is not prime. If it is 2 or 3, it is prime.
- If it is divisible by 2 or 3, it is composite.
- Otherwise divide by every number up to its square root. You only need to go that far, because if n = a × b, one of a or b must be ≤ √n. (The square root calculator gives √n.)
- If none divides evenly, the number is prime.
Example: is 97 prime? √97 ≈ 9.85, so test 2, 3, 5 and 7. None divides 97, so 97 is prime. Is 91 prime? 91 ÷ 7 = 13, so 91 is composite – a common trick question.
Sieve of Eratosthenes (listing primes)
To calculate all prime numbers from 1 to 100, write the numbers 2–100, circle 2 and cross out its multiples, circle 3 and cross out its multiples, and continue with 5 and 7 (the primes up to √100 = 10). Every number left uncrossed is prime. This calculator’s range mode uses a segmented version of this sieve, which is also the best simple prime number algorithm to code in Python, Java, C++ or JavaScript.
Prime factorization
Every whole number greater than 1 can be written as a product of primes in exactly one way (the fundamental theorem of arithmetic). Finding that product is prime factorization.
Division method (with steps)
Divide by the smallest prime that works, and repeat on the quotient until you reach 1. For 360 (the default above):
- 360 ÷ 2 = 180, 180 ÷ 2 = 90, 90 ÷ 2 = 45
- 45 ÷ 3 = 15, 15 ÷ 3 = 5
- 5 is prime.
So 360 = 2³ × 3² × 5. The factor tree method gives the same result by splitting 360 into 36 × 10, then 6 × 6 × 2 × 5, and so on until every branch ends in a prime.
Number of divisors
Add 1 to each exponent and multiply: for 2³ × 3² × 5¹, the number of divisors is (3 + 1)(2 + 1)(1 + 1) = 24.
Using prime factors for HCF and LCM
Prime factorization is the standard way to find the HCF (GCF) and LCM of numbers. HCF = product of common primes with the smallest powers; LCM = product of all primes with the largest powers. For 360 = 2³ × 3² × 5 and 84 = 2² × 3 × 7: HCF = 2² × 3 = 12 and LCM = 2³ × 3² × 5 × 7 = 2,520. Our LCM and GCD calculator does this directly. Two numbers whose HCF is 1 are called relatively prime (co-prime), for example 8 and 15.
How to find prime numbers on a calculator
A basic calculator has no prime key, but you can test divisibility quickly: divide the number by 2, 3, 5, 7, 11 and so on up to its square root and see whether any answer is a whole number. On a Casio fx-991EX or fx-991ES Plus, type the number, press =, then SHIFT and FACT to see its prime factorization directly (for numbers up to 10 digits). If only the number itself comes back, it is prime. This online prime number calculator does the same job with no limit on the steps you can see.
Why primes matter: RSA and cryptography
Large primes protect online banking, UPI and HTTPS. RSA encryption multiplies two secret primes, each hundreds of digits long, to make a public key. Multiplying them is easy, but factorising the product back into the two primes would take ordinary computers far longer than the age of the universe. That one-way difficulty is what keeps your data safe. Primes also appear in hashing, random number generation (see the random number generator) and error-correcting codes.
Interesting prime facts
- Twin primes differ by 2: (3, 5), (11, 13), (17, 19), (41, 43).
- Every prime greater than 3 is of the form 6k ± 1, which is why the calculator tests divisors in steps of 6.
- The prime number theorem says the number of primes up to x is roughly x ÷ ln x: for x = 1,00,000 that estimate is about 8,686, against the true 9,592.
- The largest known primes are Mersenne primes of the form 2ᵖ − 1, with tens of millions of digits.
Prime number or not calculator: how to figure prime numbers
Is there a way to calculate prime numbers quickly? To figure out whether a number is prime or not, the calculator tries dividing it by 2, 3 and then every number of the form 6k ± 1 up to its square root. If nothing divides evenly, it is prime. This works as a prime number or not calculator for any whole number up to 10¹⁵, so it is also a big prime number calculator: it can confirm that 999,999,999,989 is prime.
Prime number calculator technique by hand
- If the number ends in 0, 2, 4, 5, 6 or 8 (and is not 2 or 5), it is not prime.
- If its digits add up to a multiple of 3, it divides by 3.
- Find its square root and test only primes up to that value. For 221, √221 ≈ 14.9, so test 7, 11 and 13: 221 = 13 × 17, not prime.
Prime number calculator formula and prime number finder formula
No simple prime number calculator formula produces every prime. Useful facts instead: every prime above 3 has the form 6k ± 1 (but not every 6k ± 1 is prime, e.g. 25), and Euler's prime number generator equation n² + n + 41 gives primes for n = 0 to 39 before failing at n = 40 (1,681 = 41²). A prime number finder formula in practice means an algorithm such as trial division or the sieve.
Prime number generator algorithm and logic
Prime number generation logic for a list uses the Sieve of Eratosthenes: write 2 to N, circle 2 and cross out its multiples, circle the next uncrossed number and cross out its multiples, and repeat up to √N. What remains are the primes. It runs in about N log log N steps, which is why the range mode lists up to 1,00,000 numbers instantly.
Prime number generator in Python and C
A prime number generator in Python using a sieve:
def primes(n):
s = [True] * (n + 1); s[0] = s[1] = False
for i in range(2, int(n ** 0.5) + 1):
if s[i]:
s[i*i::i] = [False] * len(s[i*i::i])
return [i for i, p in enumerate(s) if p]
For a prime number generator in C, loop for (i = 2; i * i <= n; i++) if (n % i == 0) return 0; inside an is-prime function and call it for each number. In Scratch, a prime number generator uses a "repeat until" block that tests divisors from 2 up to the square root with the "mod" operator.
Prime number generator for RSA
RSA keys need two very large random primes (1,024 bits or more each). A prime number generator for RSA picks a random odd number of that size and runs a probabilistic test such as Miller–Rabin many times until one passes. Trial division, used on this page, is far too slow at that size.
Nth prime number calculator
To find the nth prime, list primes in a range and count. The 10th prime is 29, the 25th is 97, the 100th is 541 and the 1,000th is 7,919. For the 100th, list primes from 1 to 550 and read the 100th entry.
Prime factorization calculator with solution (division method)
The prime factorization calculator division method divides by the smallest prime again and again. For 360: 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45, ÷ 3 = 15, ÷ 3 = 5, ÷ 5 = 1. So 360 = 2³ × 3² × 5. This prime factorization method calculator shows the same solution steps for your number, and a prime number decomposition calculator is another name for the same thing.
Prime factorization GCF and HCF calculator
To use prime factorization as a GCF or HCF calculator, factor both numbers and multiply the common primes at their lowest powers. 360 = 2³ × 3² × 5 and 84 = 2² × 3 × 7 share 2² × 3, so HCF = 12. The LCM and GCD calculator does this for several numbers at once.
Free prime number chart and prime number list
Use the range mode as a free prime number chart generator: set From 1 and To 1000 to get all 168 primes below 1,000. Primes and chart go together here: this prime numbers chart and calculator gives the list you can print.
| Range | How many primes |
|---|---|
| 1–100 | 25 |
| 1–1,000 | 168 |
| 1–10,000 | 1,229 |
| 1–1,00,000 | 9,592 |
Prime numbers using a calculator
To check prime numbers using a basic calculator, divide by each prime up to the square root and look for a whole-number answer. This prime number finder online does all those divisions for you.
Frequently asked questions
What is a prime number?
A prime number is a whole number greater than 1 whose only factors are 1 and itself, such as 2, 3, 5, 7 and 11. Numbers with more factors are composite.
How do you check if a number is prime?
Divide it by every prime up to its square root. If none divides it evenly, the number is prime. For 97, testing 2, 3, 5 and 7 is enough, and none works, so 97 is prime.
How many prime numbers are there from 1 to 100?
There are 25: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97.
Is there a formula to calculate prime numbers?
No simple formula generates all primes. They are found by testing divisibility or with a sieve such as the Sieve of Eratosthenes, which this calculator uses for ranges.
Is 1 a prime number?
No. A prime must have exactly two different factors, and 1 has only one. 1 is neither prime nor composite.
What is the difference between prime and composite numbers?
A prime number has exactly two factors (1 and itself). A composite number has more than two, so it can be written as a product of smaller whole numbers, like 15 = 3 × 5.
How do I find the prime factorization of a number?
Keep dividing by the smallest prime that divides the number until the quotient is 1. For 360: divide by 2 three times, by 3 twice, and 5 is left, so 360 = 2³ × 3² × 5.
How do you find prime numbers on a calculator?
Divide the number by 2, 3, 5, 7 and other primes up to its square root and check for whole-number answers. Some Casio models have a FACT function that shows the prime factorization.
What is the 100th prime number?
541. The 1,000th prime is 7,919.
Is there a formula that gives all prime numbers?
No simple one. Every prime above 3 is 6k ± 1, but not every such number is prime, so primes are found by testing or sieving.
Last updated 2026-09-18