Free online math tool

Sum of Prime Numbers in a Range

Find the sum of every prime number between two whole numbers. Enter your range to calculate the total, count the primes, and view the prime numbers included in the result.

Prime Sum Calculator

Enter whole numbers from 0 to 1,000,000. The start and end values are both included.

The first number in the interval.
The last number in the interval.

What Is the Sum of Prime Numbers?

A prime number is an integer greater than 1 that has exactly two positive divisors: 1 and itself. To calculate a prime sum, identify the primes in the requested interval and add them together.

For example, the prime numbers between 1 and 10 are 2, 3, 5 and 7. Their sum is 2 + 3 + 5 + 7 = 17.

The calculator uses the Sieve of Eratosthenes, a classical method for identifying prime numbers efficiently.

Examples of Prime Sums

Range Prime numbers Sum
1 to 10 2, 3, 5, 7 17
10 to 20 11, 13, 17, 19 60
20 to 30 23, 29 52
2 to 2 2 2
0 to 1 None 0

How to Use This Calculator

  1. Enter the starting integer.
  2. Enter the ending integer.
  3. Make sure the start is not greater than the end.
  4. Click Calculate Sum of Primes.
  5. Read the sum, number of primes, prime list and calculation steps displayed below the form.

Related Math Calculators

Frequently Asked Questions

Are both endpoints included?

Yes. Both the start and end numbers are included in the interval. A prime number at either endpoint is counted.

Is 1 a prime number?

No. The number 1 has only one positive divisor, so it is not prime.

What happens if the range contains no primes?

The calculator displays a prime count of 0 and a sum of 0.

What is the maximum number I can enter?

The end number can be at most 1,000,000. This limit helps keep memory use and calculation time reasonable on shared hosting.