What Is the Consecutive Integers Calculator?
Consecutive integers are whole numbers that follow one another in order without gaps, such as 4, 5, 6, 7. A classic algebra problem asks: which n consecutive integers add up to a given sum S? This calculator solves that instantly. You supply the target sum and how many integers you want, and it returns the starting integer and the ending integer of the sequence.
How to Use It
Enter the Sum (S) you want the integers to total, then enter the Number of integers (n) you want to use. The tool computes the first integer of the run and the last integer. If the result is not a whole number, no run of exactly that many consecutive integers sums to your target — try a different count.
The Formula Explained
The sum of n consecutive integers starting at a is the arithmetic series:
$$S = a + (a+1) + (a+2) + \ldots + (a+n-1) = n \cdot a + \frac{n(n-1)}{2}.$$
Rearranging to solve for the first term gives:
$$a = \frac{S - \dfrac{n(n-1)}{2}}{n}.$$
The last integer is simply \(a + n - 1\).
Worked Example
Suppose you want 5 consecutive integers that sum to 100. Compute the offset \(\frac{n(n-1)}{2} = \frac{5 \cdot 4}{2} = 10\). Then $$a = \frac{100 - 10}{5} = \frac{90}{5} = 18.$$ So the integers are 18, 19, 20, 21, 22, and indeed \(18+19+20+21+22 = 100\). The last integer is \(18 + 5 - 1 = 22\).
FAQ
Why is my starting value a decimal? A decimal means there is no set of exactly n consecutive integers with that sum. For example, no 2 consecutive integers sum to 100, since two consecutive integers always have an odd total.
Can the integers be negative? Yes. If the sum is small relative to the count, the sequence can include negative numbers and zero.
Does this work for consecutive even or odd integers? This tool handles plain consecutive integers (step of 1). For even or odd runs the spacing differs and a separate formula applies.