StatGardenREF. DESK
Calculators/Maths/Consecutive integers from a sum
Maths

Consecutive integers from a sum calculator

Finds n evenly-spaced integers (consecutive, even or odd) that add to a target sum.

Published 6 August 2026 · Updated 23 September 2026

What this calculator does

Finding consecutive integers with a given sum is a classic algebra problem, and the arithmetic is neater than the usual setup suggests. The average of the run is simply the sum divided by how many numbers there are.

Whether an integer solution exists depends on parity. A sum of 99 splits into three consecutive integers as 32, 33, 34, and into two as 49 and 50, but there is no run of four consecutive integers that totals 99.

The formula

Formulafirst = S/n − (n−1)d/2, where d is the spacing (1 for consecutive, 2 for even/odd)

The run is symmetric about its average, so the first term is the average less half the total spread. If that first term is not a whole number, no integer solution exists.

TermMeaning
Consecutive integersA run differing by 1 at each step.
Consecutive even or oddA run differing by 2, which the spacing option selects.
Parity constraintWhy some counts have no solution for a given sum.

The inputs explained

FieldWhat to enter
Target sumThe target sum the numbers must add to.
How many numbersHow many numbers are in the run.
SpacingSpacing: 1 for consecutive integers, 2 for consecutive even or odd numbers.

When to use it

Solving a word problem

The consecutive integer problem is a staple of algebra courses.

Understanding why some cases fail

Not every sum can be split into every number of consecutive terms.

Working with even or odd runs

The spacing option handles runs that skip every other number.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

Which run lengths work for 99?

The same sum split into four different run lengths.

Target sum of 99, consecutive integers
How many numbersSequenceFirst number
2 numbers49, 5049.00
3 numbers32, 33, 3432.00
4 numbersNo exact integer solution for these inputs23.25
5 numbersNo exact integer solution for these inputs17.80
Two numbers give 49 and 50, and three give 32, 33, 34. Four and five have no integer solution, because the required first term comes out at 23.25 and 17.80 respectively.

Questions

Why do some run lengths have no solution?

Because the average must be achievable. For an odd count the average is the middle number and must itself be a whole number; for an even count it must land exactly halfway between two integers. A sum that satisfies neither has no solution at that length.

Which sums split into consecutive integers at all?

Every positive integer except the powers of two. That result is worth knowing: it means 1, 2, 4, 8, 16 and so on cannot be written as a sum of two or more consecutive positive integers.

Does this work with negative numbers?

Yes. The run can extend below zero, which is how sums smaller than the count are handled. A sum of zero, for instance, splits into −1, 0, 1.

How does even or odd spacing change things?

The run then steps by 2 instead of 1, so the spread doubles for the same count. That shifts which sums are achievable, since the first term must now also match the parity of the run.

For sequence sums in general, see the arithmetic sequence calculator. For divisibility properties, see the divisibility test calculator.