This page finds a run of consecutive integers with a given sum. Enter the sum and how many integers there are; you get the first and the last integer of the run. If the first value is not a whole number, no run of that length has that sum.
Formula
For n consecutive integers starting at x: x + (x + 1) + … + (x + n − 1) = nx + n(n − 1) ÷ 2 = S, so x = (S − n(n − 1) ÷ 2) ÷ n and the last integer is x + n − 1.
- S: the sum
- n: how many integers
- x: the first integer
Worked Example
Five consecutive integers add up to 45.
- n(n − 1) ÷ 2 = 5 × 4 ÷ 2 = 10
- x = (45 − 10) ÷ 5 = 7.00
- Last = 7 + 5 − 1 = 11.00
- Check: 7 + 8 + 9 + 10 + 11 = 45
How to read the result
A whole-number first value means the run exists. For consecutive even or odd integers the step is 2: x = (S − n(n − 1)) ÷ n. The middle of an odd-length run is always S ÷ n, here 9.
Limits and common mistakes
- If the first value has a decimal part (for example 7.50), no run of n consecutive integers has that sum.
- Negative sums work and give negative integers.
- n must be a whole number.
Frequently Asked Questions
Three consecutive integers sum to 72. What are they?
23, 24 and 25.
Can four consecutive integers sum to 10?
Yes: 1 + 2 + 3 + 4. The formula gives x = 1.
Can two consecutive integers sum to 10?
No: the formula gives 4.50, not a whole number.
What about consecutive even integers?
Use x = (S − n(n − 1)) ÷ n; three consecutive even integers summing to 48 start at 14.
Formula used
in s | Sum of the integers | - | 45 | - in n | How many consecutive integers | - | 5 | 1 | 1000000 out first | First integer | - | (s - n * (n - 1) / 2) / n | 2 out last | Last integer | - | first + n - 1 | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
- How to Calculate Anniversary Years
- Minutes in a Leap Year: Calculator & Exact Count
- Digit Sum Calculator with Solution Steps
- Decimal Addition Calculator: Steps & Examples
- Adding and Subtracting Fractions Calculator: How It Works
- Congruence Modulo Calculator (a ≡ b mod n)2