Consecutive Integers Calculator
Find consecutive integers that sum or multiply to a target value. Supports consecutive, even, and odd integer sequences with full solutions.
About
Finding a set of consecutive integers whose sum equals a given value requires solving a constrained Diophantine equation. The arithmetic series formula S = n2 ⋅ (2a + n − 1) must yield an integer starting value a. Not every target has a solution for every sequence length. A prime number, for instance, can only be expressed as a sum of consecutive integers in exactly two ways. Errors in manual computation commonly arise from off-by-one mistakes in the index bounds or from neglecting that negative starting values are valid.
This calculator solves for all valid sequences of consecutive integers (standard, even, or odd) that produce a target sum. It also supports product mode for small counts. The tool reports every qualifying sequence length from 2 up to the search limit. Approximation is not involved. Results are exact integer arithmetic. Note: product mode is computationally heavier and limited to sequences of 2 - 10 terms to maintain responsiveness.
Formulas
For n consecutive integers starting at a, the sum is given by the arithmetic series formula:
Solving for the starting integer a:
A valid solution exists if and only if a ∈ Z (i.e., the result is an integer with no remainder).
For consecutive even integers with step 2, starting at even value a:
Rearranging: a = S − n(n − 1)n. Valid when a is an even integer. The same formula applies to consecutive odd integers, but a must be odd.
Where: S = target sum, n = number of integers in the sequence, a = first integer of the sequence.
Reference Data
| Target Sum | Type | Count (n) | Starting Integer (a) | Sequence |
|---|---|---|---|---|
| 15 | Consecutive | 5 | 1 | 1, 2, 3, 4, 5 |
| 15 | Consecutive | 3 | 4 | 4, 5, 6 |
| 15 | Consecutive | 2 | 7 | 7, 8 |
| 15 | Consecutive | 6 | 0 | 0, 1, 2, 3, 4, 5 |
| 100 | Consecutive | 5 | 18 | 18, 19, 20, 21, 22 |
| 100 | Consecutive | 8 | 9 | 9, 10, 11, 12, 13, 14, 15, 16 |
| 100 | Consecutive | 25 | −8 | −8, −7, …, 15, 16 |
| 50 | Even | 5 | 6 | 6, 8, 10, 12, 14 |
| 45 | Odd | 3 | 13 | 13, 15, 17 |
| 45 | Odd | 5 | 5 | 5, 7, 9, 11, 13 |
| 45 | Odd | 9 | −3 | −3, −1, 1, 3, 5, 7, 9, 11, 13 |
| 1000 | Consecutive | 16 | 55 | 55, 56, …, 69, 70 |
| 1000 | Consecutive | 25 | 28 | 28, 29, …, 51, 52 |
| 120 | Product | 3 | 4 | 4 × 5 × 6 |
| 5040 | Product | 7 | 1 | 1 × 2 × 3 × 4 × 5 × 6 × 7 |