Advertisement

Consecutive integers calculator

Choose a sum or product, the number of terms, and the allowed integers. Each sequence increases by 1, or by 2 for even and odd integers.

Calculator

Matching sequences
3, 4, 5
Number of sequences
1

Advertisement

How this calculator works

A sequence is determined by its first integer, count and step. The sum gives a linear equation for the first term. For products, the tool checks sequences crossing zero and searches positive sequences using exact integers; reflecting them also finds wholly negative sequences. A parity check keeps only the requested even or odd starts.

Formula

Terms: a, a+d, ..., a+(n-1)d. Sum = na + dn(n-1)/2. Product = a(a+d)...(a+(n-1)d), where d is 1 or 2.

Worked example

Three consecutive integers summing to 12 are 3, 4, 5. Two consecutive integers with product 6 have two solutions: -3, -2 and 2, 3.

Advertisement

Frequently asked questions

Can the answer include negative integers?

Yes. All matching sequences are shown, ordered by first term.

Why can there be no solution?

The required first term may not be an integer or may have the wrong parity. A product may also be impossible for that count.

What are the input limits?

Use 1 to 50 terms and a target in the safe integer range. Intermediate products use exact integer arithmetic.

Sources

Advertisement