Primes in Range Calculator

Enter a start and end number to list every prime number in that range.

How it is calculated

The tool walks through every whole number from start to end, both included, and tests each one by trial division: numbers below 2 are rejected, even numbers above 2 are rejected, and an odd number n is divided by 3, 5, 7, … while i × i ≤ n. Those that survive are listed in ascending order, followed by their count. Both ends must be whole numbers, the start cannot be negative, the end cannot be below the start, and the span end − start may not exceed 1 000 000; otherwise there is no result. A range with no primes is not an error: it shows an empty list and a count of 0.

Worked example

List the primes from 90 to 120. Step 1: even numbers are out, leaving the odd ones 91 to 119. Step 2: remove multiples of 3, 5, 7: for example 91 = 7 × 13, 93 = 3 × 31, 95 = 5 × 19, 99 = 9 × 11, 105, 111, 115, 117 and 119 = 7 × 17 all fail. Step 3: the numbers that remain are prime. The tool prints 97, 101, 103, 107, 109, 113, a count of 6.

Try this example →

Common mistakes

  • Expecting the endpoints to be excluded. Start and end are both tested, so a range from 7 to 7 returns 7.
  • Entering the end before the start. A reversed range returns no result rather than swapping the values.
  • Treating 1 as a prime or 2 as a non-prime. The tool counts 2 as prime, the only even one, and never counts 1.
  • Entering a decimal or a range wider than a million numbers and expecting a list; such inputs are refused.
  • Reading an empty list as an error. Ranges such as 24 to 28 simply contain no primes.

About this calculator

Finding every prime number in a given range means checking each integer from the start value to the end value and determining whether it has any divisors other than 1 and itself — this calculator tests each number by trial division, checking odd divisors only up to its square root. Large-scale tools often use the Sieve of Eratosthenes instead, an ancient algorithm that eliminates multiples of each prime as it goes rather than testing every number individually, making it far faster for very large ranges.

Students in number theory and discrete math courses use prime-range listings to explore how prime density thins out as numbers grow larger, a pattern described by the prime number theorem, while programmers and computer science students use the same kind of range-based prime generation to test and benchmark sieve algorithms, and cryptography courses reference prime generation as the conceptual starting point for how large primes get selected in RSA key generation.

This calculator takes a starting and ending number and lists every prime found in that range, along with a count of how many there are. The end number can be at most 1,000,000 above the start number.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators