Prime Number Sum Calculator
Add up all prime numbers inside any range, sum primes up to any number, or find the sum of the first N primes with 100% exact math.
Watch the Running Total Grow (First 25 Primes)
Drag the slider to add primes one by one from 2 up to 97. Notice how the running total climbs faster and faster as the primes get larger:
Interactive Tool: Adding Prime Fractions (1/p)
If you turn every prime into a fraction (like 1/2 + 1/3 + 1/5 + 1/7...) and add them all together, does the total ever hit a limit? Leonhard Euler proved that it keeps growing forever without stopping (∑ 1/p = ∞).
Later, Franz Mertens discovered a shortcut formula for how slowly it grows: ln(ln x) + 0.2615.
Enter any upper limit below to compare the actual fraction sum against Mertens' estimate:
Why the Average Prime Is Always Below Halfway
If you take all primes up to a number X, their average is always less than the halfway mark (X / 2). Why? Because prime numbers are packed tightly together at the beginning of the number line and become much rarer as numbers get larger. All those small primes pull the average downward:
Quick Reference Table of Prime Sums
Check the exact sums and averages for common ranges and prime counts. Click any row to load it into the calculator above:
| Range or Count | Primes Count | Total Sum | Average | Action |
|---|---|---|---|---|
| Primes ≤ 10 | 4 | 17 | 4.25 | |
| Primes ≤ 20 | 8 | 77 | 9.63 | |
| Primes ≤ 30 | 10 | 129 | 12.90 | |
| Primes ≤ 50 | 15 | 328 | 21.87 | |
| Primes ≤ 100 | 25 | 1,060 | 42.40 | |
| Primes ≤ 200 | 46 | 4,227 | 91.89 | |
| Primes ≤ 500 | 95 | 21,536 | 226.69 | |
| Primes ≤ 1,000 | 168 | 76,127 | 453.14 | |
| Primes ≤ 2,000 | 303 | 277,050 | 914.36 | |
| Primes ≤ 5,000 | 669 | 1,548,136 | 2,314.10 | |
| Primes ≤ 10,000 | 1,229 | 5,736,396 | 4,667.53 | |
| Primes ≤ 20,000 | 2,262 | 21,171,191 | 9,359.50 | |
| Primes ≤ 50,000 | 5,133 | 121,013,308 | 23,575.55 | |
| Primes ≤ 100,000 | 9,592 | 454,396,537 | 47,372.45 | |
| First 10 Primes | 10 | 129 | 12.90 | |
| First 25 Primes | 25 | 1,060 | 42.40 | |
| First 50 Primes | 50 | 5,117 | 102.34 | |
| First 100 Primes | 100 | 24,133 | 241.33 | |
| First 250 Primes | 250 | 182,109 | 728.44 | |
| First 500 Primes | 500 | 824,693 | 1,649.39 |
Step-by-Step Examples
Four simple step-by-step examples showing how adding prime numbers works and what patterns show up:
Primes: 2, 3, 5, 7 (4 primes).
Addition: 2 + 3 = 5; 5 + 5 = 10; 10 + 7 = 17.
Fun Fact: Notice that the sum 17 is itself a prime number!
Prime Count: Exactly 25 primes between 2 and 97.
Even/Odd Rule: 1 even prime + 24 odd primes = even sum (1,060 ends in 0).
Average: 1,060 / 25 = 42.40 (15.2% below halfway at 50).
Numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.
Total: (2+3+5+7+11) + (13+17+19+23+29) = 28 + 101 = 129.
Factors: 129 = 3 × 43 (not prime).
Exact Sum: 76,127 across 168 primes.
Estimate Formula: x² / (2 ln x) = 1,000,000 / (2 × 6.90776) ≈ 72,382.
Accuracy: The estimate gets within 5% of the exact answer.
The Even-Odd Rule for Adding Primes Starting at 2
Can adding consecutive primes starting from 2 give you another prime number? Let's look at whether the answer is even or odd:
Why: Your list includes one even prime (2) plus (N - 1) odd primes. When N is odd (like 3, 5, or 7 primes), (N - 1) is an even count of odd numbers. Adding an even count of odd numbers always gives an even number. Adding 2 keeps the total even. Since any even number bigger than 2 can be divided by 2, the sum can never be prime.
| Count | Numbers Added | Even or Odd | Prime or Not? |
|---|---|---|---|
| N = 2 | 2 + 3 = 5 | Odd | Prime! |
| N = 3 | 2 + 3 + 5 = 10 | Even | Not Prime (Divisible by 2) |
| N = 4 | 2 + 3 + 5 + 7 = 17 | Odd | Prime! |
| N = 5 | 2 + 3 + 5 + 7 + 11 = 28 | Even | Not Prime (Divisible by 2) |
| N = 6 | 2 + 3 + 5 + 7 + 11 + 13 = 41 | Odd | Prime! |
Related Prime Tools
Frequently Asked Questions
What is the sum of prime numbers up to 100?
The sum of all 25 prime numbers from 1 to 100 is exactly 1,060 (2 + 3 + 5 + 7 + 11 + ... + 97 = 1,060).
What is the sum of the first 10 prime numbers?
The first 10 primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. Adding them together gives exactly 129.
How does this calculator handle huge numbers without rounding errors?
Our calculator uses JavaScript's built-in BigInt system for whole numbers. Regular computer numbers start losing precision once totals pass 9 quadrillion (9,007,199,254,740,991). BigInt does not have this limit, ensuring every single digit in your sum is 100% exact.
Is there a simple shortcut formula to add up all primes up to a number?
There is no simple formula that gives the exact sum directly. However, mathematicians proved that the sum of all primes up to a number x is roughly x² / (2 ln x). Similarly, the sum of the first N primes is roughly ½ N² ln N. These approximations get closer in percentage as the numbers get larger.
Why is adding an odd count of primes starting from 2 always composite (not prime)?
Because 2 is the only even prime, starting at 2 means your list has 2 plus several odd primes. If you add an odd count of primes (like 3, 5, or 7 primes), you have 1 even prime plus an even count of odd primes. Adding an even number of odd numbers always produces an even total. Adding 2 keeps the total even. Since any even number greater than 2 is divisible by 2, the sum can never be prime!
Why is the average of primes up to 100 less than 50?
The 25 primes up to 100 add up to 1,060, giving an average of 42.40. This is lower than the middle number 50 because primes are crowded together at the start of the number line and space out more as numbers get bigger. Because there are more small primes than big primes, the average gets pulled toward the lower end.
What happens if you add up the fractions 1/p for all primes?
In 1737, Leonhard Euler proved that if you keep adding the fractions 1/2 + 1/3 + 1/5 + 1/7 + ..., the total keeps growing forever without stopping (it diverges to infinity). In 1874, Franz Mertens showed that this fraction sum grows very slowly, roughly following ln(ln x) + 0.2615.
Can the sum of consecutive primes ever be a square number?
Yes! For example, adding the first 9 primes (2 + 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23) equals exactly 100, which is 10 × 10 (10²). Mathematicians enjoy finding sequences of primes that add up to square or cube numbers.