Number Sequence Calculator
This number sequence calculator finds the nth term and the sum of the first n terms for arithmetic and geometric sequences. Supply the first term, a common difference or ratio, and an integer term count; the result uses first-term indexing rather than a zero-based programming index.
By Dr. Hassan Khames EliwaLast updated
Result
- Sum of first n terms
- 185
- Terms included
- 10
How it works
Choose the rule, not just the first few values
An arithmetic sequence adds the same difference each time. Its nth term is a + (n − 1)d, where a is the first term and d is the common difference. Its finite sum is n(a + last)/2. The endpoint average works because terms pair symmetrically from the beginning and end of the sequence. A negative difference gives a decreasing sequence and can carry it through zero.
A geometric sequence multiplies each term by the same ratio r. Its nth term is a times r raised to the power n − 1. For r other than unity, the familiar finite sum is a(1 − rⁿ)/(1 − r). When the ratio equals unity, every term equals a and the sum is na; dividing by the usual denominator would be invalid. This calculator handles that constant sequence explicitly.
Finite summation with practical safeguards
The implementation generates geometric terms successively and adds them using compensated summation. This avoids subtracting nearly equal powers when the ratio is close to unity and naturally supports alternating signs. A negative ratio alternates term signs. A zero ratio leaves the first term in place and makes subsequent terms zero. A zero first term generates an entirely zero sequence, even with a large allowed ratio.
The term count must be an integer from 1 through 10000. The first term and difference or ratio must be finite with magnitude no greater than 1e12. These bounds keep browser work predictable, but they do not guarantee every geometric sequence fits ordinary floating-point arithmetic. Overflow and terminal nonzero-term underflow produce an error asking you to rescale or reduce the count.
Interpret the outputs in context
Ordinary results display up to eight decimal places. Very large or small nonzero answers use scientific notation so a tiny quantity does not disappear merely because of decimal formatting. These are numerical results, not symbolic rational expressions. Rounding can still obscure a small residual when positive and negative contributions almost cancel. For rates attached to money or population, decide whether a smooth mathematical progression is a reasonable model before treating the projection as a forecast.
Worked example
Stepped seating rows
An event layout starts with 5 seats in its first row and adds 3 seats per row. Choose arithmetic mode, first term 5, difference 3, and count 10. The tenth row has 32 seats, and the first ten rows contain 185 seats altogether. The endpoint check is straightforward: the average of 5 and 32 is 18.5, and multiplying by 10 produces the total. The first row is already included; there are only nine increases before the tenth row.
Doubling a batch
A test process begins with 3 samples and doubles the batch each round. In geometric mode use first term 3, ratio 2, and count 5. The fifth batch contains 48 samples, while all five batches together contain 93. As a constant-ratio check, changing the ratio to 1 leaves the fifth term at 3 and makes the five-term sum 15. The number of batches has not changed; only the growth rule has.
Expert tips
Common mistakes
- Entering a percentage as a ratio. A multiplicative growth factor includes the retained base amount. A percentage rate and a ratio are related but are not interchangeable input formats.
- Confusing the final term with the total. The nth term describes one position; the sum accumulates every included position. They answer different purchasing and capacity questions.
- Expecting huge powers to remain finite. A bounded count does not bound geometric magnitudes. Rapid multiplication can exceed the numeric range long before reaching the allowed term limit.
Frequently asked questions
Can the common difference be negative?
Yes. Arithmetic sequences may decrease, pass through zero, and become negative. The formulas and sum apply without changing the sign convention.
What does a negative ratio mean?
Each multiplication changes the sign as well as the magnitude when the ratio is negative. The resulting alternating sum may be much smaller than the magnitude of an individual term.
What happens when n is the first position?
The nth term and sum both equal the first term. No common difference or ratio has yet been applied, although the rule input must still be a valid finite number.
Does this identify a sequence from pasted terms?
No. You choose the model and provide its rule. Many different mathematical patterns can fit a short list, so automatic identification would need assumptions this calculator does not make.
Can I calculate an infinite geometric sum?
This page reports only finite sums. An infinite geometric sum requires a separate convergence condition on the ratio and a different interpretation of what the total represents.
Related calculators
Sources and standards
About the author
Dr. Hassan Khames Eliwa holds a PhD in Construction & Built Environment and has more than 20 years of international project controls experience. He is Director of Eliwa Project Controls Limited in Auckland and founder of PMMilestone.org and PMMilestone.com.
Buy me a coffee