One number
Multiples of 7 up to 100: 735.
Sum of all multiples of k, or of k₁ or k₂, below or up to N, by inclusion–exclusion.
Enter your values below to get started.
Below N excludes N itself; Project Euler problem 1 uses "below 1,000".
The sum of the multiples of k up to N is k·m(m + 1)/2 with m = ⌊N/k⌋.
For OR, numbers divisible by 2 of the k are counted once: the calculator subtracts the multiples of their LCM.
AND means multiples of the least common multiple (LCM): 4 and 6 → multiples of 12.
A multiple sum calculator adds every multiple of one or more numbers in a range, so the multiples of 3 or 5 below 1,000 add up to 233,168. Enter up to 8 divisors, choose "any of" (OR) or "all of" (AND), set N and the start value, and get the exact sum, the count, each inclusion–exclusion term and a running-sum chart, even for N with 30 digits.
A multiple sum is the total of every number in a range that is divisible by a given number k, or by at least one of several numbers. The multiples of 3 or 5 below 10 are 3, 5, 6 and 9, and their sum is 23.
A multiple of k is k × j for a whole number j: the multiples of 7 are 7, 14, 21, 28, …. A number divisible by 2 different divisors, such as 15 for 3 and 5, belongs to both lists but is added once. This problem opens Project Euler, the problem archive Colin Hughes started in 2001: Problem 1 asks for the sum of all multiples of 3 or 5 below 1,000.
The multiple sum calculator uses a closed formula for each divisor and the inclusion–exclusion principle for overlaps, so the work does not depend on N. Summing the multiples of 3 or 5 below 109 takes 3 formula evaluations instead of checking 999,999,999 numbers: 233,333,333,166,666,668.
Below N uses N − 1; up to N uses N. A start value a subtracts the sum up to a − 1.
m = ⌊limit / k⌋ multiples of k: ⌊999 / 3⌋ = 333.
k·m(m + 1)/2 = 3 × 333 × 334 / 2 = 166,833.
Add single divisors, subtract pairs (their LCM), add triples, and so on.
The sum of the multiples of k up to N is S = k·m(m + 1)/2, where m = ⌊N/k⌋ is the number of multiples. The multiples k, 2k, …, mk are k times 1, 2, …, m, and 1 + 2 + … + m = m(m + 1)/2.
Multiples of 7 up to 100: m = 14, S = 7 × 14 × 15 / 2 = 735.
Below 1,000: 166,833 + 99,500 − 33,165 = 233,168.
There are 5 types of multiple sums: multiples of one number, multiples of any of several numbers (OR), multiples of all of them (AND), multiples in a range and multiples of one number but not another. Each type reduces to the one-divisor formula.
Multiples of 7 up to 100: 735.
Multiples of 4 or 6 up to 100: 1,300 + 816 − 432 = 1,684.
Multiples of 4 and 6 = multiples of lcm 12: 432 up to 100.
Multiples of 7 from 50 to 150: 56 + 63 + … + 147 = 1,421.
Multiples of 4 but not 6 up to 100: 1,300 − 432 = 868.
To calculate the sum of multiples by hand, count the multiples with m = ⌊N/k⌋, apply k·m(m + 1)/2 to each divisor, and subtract the multiples of each pair's LCM. Here are the multiples of 3 or 5 below 1,000:
The inclusion–exclusion principle adds the sums for single divisors, subtracts the sums for every pair, adds them back for every triple, and so on, so each number is counted exactly once. With d divisors there are 2d − 1 terms: 3 for 2 divisors, 7 for 3, 15 for 4.
Abraham de Moivre used the principle in 1718, and James Joseph Sylvester stated the general form in the 19th century. Each term uses the least common multiple (LCM), not the product: the overlap of 4 and 6 is the multiples of 12, not of 24.
Enter the divisors, the limit N and the start value, choose Below N or Up to N, pick Any (OR) or All (AND) and press Calculate. The result card shows the sum, the count and the first multiples; the tabs list each step, chart the running sum and table every inclusion–exclusion term.
One number such as 7, or up to 8 numbers such as 3, 5, 7.
Limit N, start value and Below N (<) or Up to N (≤).
Any (OR) counts numbers divisible by at least one k; All (AND) needs every k.
The Inclusion–exclusion tab lists each LCM with its sign, count and sum.
Sums of multiples appear in programming tests, scheduling and payroll, wherever an event repeats every k steps. There are 5 common uses:
Sums of multiples with their counts.
| Multiples | Range | Count | Sum | Calculator |
|---|---|---|---|---|
| 3 or 5 | below 10 | 4 | 23 | |
| 3 or 5 | below 1,000 | 466 | 233,168 | |
| 7 | up to 100 | 14 | 735 | |
| 4 or 6 | up to 100 | 33 | 1,684 | |
| 4 and 6 | up to 100 | 8 | 432 | |
| 2 or 3 | below 100 | 66 | 3,317 | |
| 9 | 100 to 500 | 44 | 13,266 |
Try each one, then reveal the answer or solve it in the calculator.
Find the sum of all multiples of 3 or 5 below 1,000 (Project Euler 1).
Find the sum of the multiples of 7 up to 1,000.
Find the sum of the numbers up to 200 divisible by both 6 and 8.
Find the sum of all 3-digit multiples of 11.
Find the sum of the multiples of 3, 5 or 7 below 1,000.
Find the sum of all multiples of 3 or 5 below 1,000,000,000.
Discover 67 free sum calculators across different categories. Find the right calculator for your needs.
Try a different name or choose another category.
A multiple sum calculator is an online tool that adds every multiple of one or more numbers in a range. This calculator handles up to 8 divisors with OR or AND logic, below or up to N, from any start value.
The sum of all multiples of 3 or 5 below 1,000 is 233,168: 166,833 for 3, plus 99,500 for 5, minus 33,165 for 15.
The sum of the multiples of k up to N is k·m(m + 1)/2, where m = ⌊N/k⌋. For k = 7 and N = 100, m = 14 and the sum is 735.
Multiples of 15 are multiples of both 3 and 5, so adding the 2 lists counts each of them twice. Subtracting the multiples of 15 once fixes the double count.
No, below N excludes N and up to N includes N. They differ only when N itself is a multiple: multiples of 5 below 100 add to 950, and up to 100 add to 1,050.
There are ⌊(N − 1)/k⌋ multiples of k below N. Below 1,000 there are 333 multiples of 3 and 199 multiples of 5.
Yes, the calculator uses exact BigInt formulas, so N can have up to 30 digits and the answer appears instantly.
A number is a multiple of both a and b exactly when it is a multiple of lcm(a, b). The overlap of 4 and 6 is the multiples of 12.
Subtract the sum up to a − 1 from the sum up to b. Multiples of 7 from 50 to 150: 1,617 − 196 = 1,421.
A multiple sum adds every multiple of k in a range, and the formula k·m(m + 1)/2 with inclusion–exclusion gives the answer for any number of divisors without listing a single multiple. The multiple sum calculator applies those formulas exactly, shows every term and handles N up to 30 digits.
Not sure which settings to use? Answer 3 questions below.