Arithmetic Sequence Calculator: nth Term, Sum, Term Count and Common Difference
About this calculator The arithmetic sequence calculator handles sequences in which every term differs from the previous one by the same amount. Enter the first term a 1 a_1 a 1 , common difference d d d and number of terms n n n to get the nth term a n = a 1 + ( n − 1 ) d a_n = a_1 + (n-1)d a n = a 1 + ( n − 1 ) d and the sum of the first n n n terms S n = n ( a 1 + a n ) 2 S_n = \dfrac{n(a_1 + a_n)}{2} S n = 2 n ( a 1 + a n ) . If the last term is known, it can also solve for the term count n n n or the common difference d d d .
The odd numbers 1, 3, 5, 7, …; theater rows that gain 2 seats each row; a savings plan that increases by 50 each month; or training distance reduced by 1.5 km each day are all arithmetic sequences as long as the increment stays constant. It is the simplest sequence model and a useful starting point for understanding accumulation. The end-pairing trick behind the sum formula is famously associated with the young Gauss.
What it does not do: it does not handle geometric sequences, where each term is a fixed multiple of the previous one, as in compound interest. It also does not handle second-order differences or recurrences such as Fibonacci sequences, and it does not list every term. Its primary outputs are the nth term and the total.
How to use this calculator 01 Open the panel this page corresponds to “Math tools → Formulas → Arithmetic sequence” (/#/mathtools/formula?calculator=calculator.arithmetic-seq). Initially only “First term a₁” = 1 and “Difference d” = 2 are filled; “Term count n” is empty. At that moment the nth term displays −1 and the sum 0 because the engine substitutes an empty n n n as 0 into a 1 + ( 0 − 1 ) d a_1 + (0-1)d a 1 + ( 0 − 1 ) d . Those are not meaningful results; enter n n n to get the intended calculation. 02 Find the nth term and sum enter a positive integer in “Term count n”. Both fields marked as computed update together. 03 Solve for the term count clear “Term count n”, enter the last term in “nth term aₙ”, and keep a 1 a_1 a 1 and d d d . The term-count field becomes computed. During this mode “Sum” displays 0 because the engine falls back to n = 0 n = 0 n = 0 ; enter the solved n n n back into the term-count field and clear a n a_n a n to obtain the real sum. 04 Solve for the common difference clear “Difference d” and enter a 1 a_1 a 1 , n n n and a n a_n a n . The difference field returns ( a n − a 1 ) / ( n − 1 ) (a_n - a_1)/(n-1) ( a n − a 1 ) / ( n − 1 ) . The sum is temporarily evaluated with d = 0 d = 0 d = 0 , so it shows n ⋅ a 1 n \cdot a_1 n ⋅ a 1 rather than the real sum. Enter the solved d d d back into the field to calculate the sum. 05 Read the result values are shown to at most 8 decimal places with trailing zeros removed. If a solved n n n is not an integer, such as 16.66666667, the supplied a n a_n a n is not a term of that sequence. 06 Copy the formula the copy button beside the panel title copies aₙ = a₁ + (n-1)d, S = n(a₁+aₙ)/2 to the clipboard.
Worked examples All four examples were recalculated with the arithmetic-seq engine compute function. Displayed values use at most 8 decimal places with trailing zeros removed.
Example 1: 3, 7, 11, 15, 19, 23 — six terms
Input: a 1 = 3 a_1 = 3 a 1 = 3 , d = 4 d = 4 d = 4 , n = 6 n = 6 n = 6 .
The sixth term is a 6 = 3 + ( 6 − 1 ) × 4 = 3 + 20 = 23 a_6 = 3 + (6-1) \times 4 = 3 + 20 = 23 a 6 = 3 + ( 6 − 1 ) × 4 = 3 + 20 = 23 .
The sum is S 6 = 6 × ( 3 + 23 ) 2 = 6 × 26 2 = 78 S_6 = \dfrac{6 \times (3 + 23)}{2} = \dfrac{6 \times 26}{2} = 78 S 6 = 2 6 × ( 3 + 23 ) = 2 6 × 26 = 78 .
The UI shows nth term 23 and sum 78 . With the alternate form: 6 × 3 + 6 × 5 2 × 4 = 18 + 60 = 78 6 \times 3 + \dfrac{6 \times 5}{2} \times 4 = 18 + 60 = 78 6 × 3 + 2 6 × 5 × 4 = 18 + 60 = 78 . By pairing the ends, 3 + 23 = 7 + 19 = 11 + 15 = 26 3 + 23 = 7 + 19 = 11 + 15 = 26 3 + 23 = 7 + 19 = 11 + 15 = 26 : three pairs of 26 give 78.
Figure 1: Example 1. Left, Gauss pairing makes every first-last pair equal a₁ + aₙ. Right, two copies of the staircase form a rectangle of area n(a₁ + aₙ); one copy is half of it, Sₙ
Example 2: the default input and Gauss's 1 through 100
Input a 1 = 1 a_1 = 1 a 1 = 1 , d = 2 d = 2 d = 2 , n = 10 n = 10 n = 10 : the tenth term is 1 + 9 × 2 = 19 1 + 9 \times 2 = 19 1 + 9 × 2 = 19 and the sum is 10 × ( 1 + 19 ) / 2 = 100 10 \times (1 + 19) / 2 = 100 10 × ( 1 + 19 ) /2 = 100 . The UI shows nth term 19 and sum 100 . The first 10 odd numbers sum to 10 2 10^2 1 0 2 . Change n = 100 n = 100 n = 100 and the UI shows nth term 199 and sum 10000 : the first n n n odd numbers always sum to n 2 n^2 n 2 .
Now enter a 1 = 1 a_1 = 1 a 1 = 1 , d = 1 d = 1 d = 1 , n = 100 n = 100 n = 100 . The UI shows nth term 100 and sum 5050 . This is the problem in the well-known story of the young Gauss pairing 1 + 100 = 2 + 99 = ⋯ = 50 + 51 1 + 100 = 2 + 99 = \cdots = 50 + 51 1 + 100 = 2 + 99 = ⋯ = 50 + 51 : 50 pairs, each equal to 101.
Example 3: theater seats and a decreasing sequence
Theater : the first row has 20 seats, each later row has 2 more, and there are 15 rows. Enter a 1 = 20 a_1 = 20 a 1 = 20 , d = 2 d = 2 d = 2 , n = 15 n = 15 n = 15 . The last row has 20 + 14 × 2 = 48 20 + 14 \times 2 = 48 20 + 14 × 2 = 48 seats, and the total is 15 × ( 20 + 48 ) / 2 = 510 15 \times (20 + 48)/2 = 510 15 × ( 20 + 48 ) /2 = 510 . The UI shows nth term 48 and sum 510 .
Decreasing sequence : suppose inventory starts at 100 kg and 7 kg is shipped each day. Enter a 1 = 100 a_1 = 100 a 1 = 100 , d = − 7 d = -7 d = − 7 , n = 12 n = 12 n = 12 . Day 12 inventory is 100 − 77 = 23 100 - 77 = 23 100 − 77 = 23 , and the sum of daily inventories is 12 × ( 100 + 23 ) / 2 = 738 12 \times (100 + 23)/2 = 738 12 × ( 100 + 23 ) /2 = 738 kg·day, equivalent to an average inventory of 61.5 kg over 12 days. The UI shows nth term 23 and sum 738 . The formulas are unchanged when the common difference is negative.
Saving 50 more each month : save 100 in month 1, then 50 more than the previous month for a year. With a 1 = 100 a_1 = 100 a 1 = 100 , d = 50 d = 50 d = 50 , n = 12 n = 12 n = 12 , month 12 is 650 and the annual total is 4500 .
Example 4: solving for term count and common difference
Solve for n : which term of 5, 8, 11, … is 50? Enter a 1 = 5 a_1 = 5 a 1 = 5 , d = 3 d = 3 d = 3 , a n = 50 a_n = 50 a n = 50 and clear n. Then n = ( 50 − 5 ) / 3 + 1 = 16 n = (50 - 5)/3 + 1 = 16 n = ( 50 − 5 ) /3 + 1 = 16 . The UI shows term count 16 and sum 0 under the solve-mode convention described in step 3. Enter 16 back into the term-count field and clear a n a_n a n to get nth term 50 and sum 440 .
If the target is 52, n = ( 52 − 5 ) / 3 + 1 = 16.66666667 n = (52 - 5)/3 + 1 = 16.66666667 n = ( 52 − 5 ) /3 + 1 = 16.66666667 . That is not an integer, so 52 is not in the sequence: term 16 is 50 and term 17 is 53.
Solve for d : starting at 2 and reaching 30 on term 8, what is the difference? Enter a 1 = 2 a_1 = 2 a 1 = 2 , n = 8 n = 8 n = 8 , a n = 30 a_n = 30 a n = 30 and clear d. Then d = ( 30 − 2 ) / ( 8 − 1 ) = 4 d = (30 - 2)/(8 - 1) = 4 d = ( 30 − 2 ) / ( 8 − 1 ) = 4 . The UI shows difference 4 and sum 16 because the engine temporarily evaluates the sum with d = 0 d = 0 d = 0 , giving 8 × 2 = 16 8 \times 2 = 16 8 × 2 = 16 . Enter 4 back into the difference field and clear a n a_n a n to get nth term 30 and sum 128 .
项数不是整数、公差为零时
The engine will still evaluate n = 2.5 n = 2.5 n = 2.5 ; with a 1 = 1 a_1 = 1 a 1 = 1 and d = 2 d = 2 d = 2 it returns nth term 4 and sum 6.25, but “two and a half terms” has no discrete-sequence meaning. Solving for n n n with d = 0 d = 0 d = 0 divides by zero, so the term-count field is blank. When d = 0 d = 0 d = 0 , every term is a 1 a_1 a 1 and any valid integer n n n describes the same constant sequence.
You can reproduce Example 1 directly in the panel. Change n n n from 6 to 12, 24 and 48 to see that the nth term grows linearly with n n n , while the sum grows roughly with n 2 n^2 n 2 : doubling the term count makes the sum about four times as large.
Principle and derivation nth term: from recurrence to direct formula
The definition is recursive: a k + 1 = a k + d a_{k+1} = a_k + d a k + 1 = a k + d . Moving from a 1 a_1 a 1 to a n a_n a n requires adding d d d exactly n − 1 n - 1 n − 1 times, so a n = a 1 + ( n − 1 ) d a_n = a_1 + (n-1)d a n = a 1 + ( n − 1 ) d . It is n − 1 n - 1 n − 1 , not n n n : six bars have only five gaps between them, which is the same off-by-one idea seen in fence-post problems.
Treating n n n as a variable, a n = d ⋅ n + ( a 1 − d ) a_n = d \cdot n + (a_1 - d) a n = d ⋅ n + ( a 1 − d ) is a straight line with slope d d d and intercept a 1 − d a_1 - d a 1 − d , the formal “term zero”. An arithmetic sequence is therefore a linear function restricted to positive integer inputs. The tops of the bars in Figure 1 lie on a line. The slope between any two sequence terms is the common difference, and d = ( a n − a 1 ) / ( n − 1 ) d = (a_n - a_1)/(n-1) d = ( a n − a 1 ) / ( n − 1 ) is exactly rise divided by run.
Sum: Gauss pairing
Write S n S_n S n once in forward order and once in reverse, then add the two rows:
S n = a 1 + ( a 1 + d ) + ⋯ + ( a n − d ) + a n S n = a n + ( a n − d ) + ⋯ + ( a 1 + d ) + a 1 2 S n = ( a 1 + a n ) + ( a 1 + a n ) + ⋯ + ( a 1 + a n ) = n ( a 1 + a n ) \begin{aligned}
S_n &= a_1 + (a_1 + d) + \cdots + (a_n - d) + a_n \\
S_n &= a_n + (a_n - d) + \cdots + (a_1 + d) + a_1 \\
2S_n &= (a_1 + a_n) + (a_1 + a_n) + \cdots + (a_1 + a_n) = n\,(a_1 + a_n)
\end{aligned} S n S n 2 S n = a 1 + ( a 1 + d ) + ⋯ + ( a n − d ) + a n = a n + ( a n − d ) + ⋯ + ( a 1 + d ) + a 1 = ( a 1 + a n ) + ( a 1 + a n ) + ⋯ + ( a 1 + a n ) = n ( a 1 + a n )
Every column totals a 1 + a n a_1 + a_n a 1 + a n : when one term is larger by d d d , the term paired with it is smaller by d d d . There are n n n columns, so S n = n ( a 1 + a n ) / 2 S_n = n(a_1 + a_n)/2 S n = n ( a 1 + a n ) /2 . For an odd number of terms, the middle term pairs with itself; it is exactly ( a 1 + a n ) / 2 (a_1 + a_n)/2 ( a 1 + a n ) /2 , the average of all terms. Figure 1 shows the same argument geometrically: an upright staircase and an inverted copy form a rectangle of size n × ( a 1 + a n ) n \times (a_1 + a_n) n × ( a 1 + a n ) .
Substituting a n = a 1 + ( n − 1 ) d a_n = a_1 + (n-1)d a n = a 1 + ( n − 1 ) d gives S n = n a 1 + n ( n − 1 ) 2 d S_n = n a_1 + \dfrac{n(n-1)}{2} d S n = n a 1 + 2 n ( n − 1 ) d : n n n copies of a 1 a_1 a 1 plus 0 + 1 + ⋯ + ( n − 1 ) = n ( n − 1 ) / 2 0 + 1 + \cdots + (n-1) = n(n-1)/2 0 + 1 + ⋯ + ( n − 1 ) = n ( n − 1 ) /2 copies of d d d . This also makes the quadratic dependence on n n n explicit.
Reading the formula as “average × count”
S n = n ⋅ a 1 + a n 2 S_n = n \cdot \dfrac{a_1 + a_n}{2} S n = n ⋅ 2 a 1 + a n says that the total equals the average of the first and last terms times the number of terms. In an arithmetic sequence, that endpoint average is also the average of every term because the terms are symmetric around the midpoint. In the inventory example, 738 = 61.5 × 12 is simply average inventory × days. The same structure appears in the trapezoid area formula and in constant-acceleration displacement written as average velocity × time.
Arithmetic versus geometric: simple and compound interest
An arithmetic sequence adds a fixed amount each step; a geometric sequence multiplies by a fixed factor. A principal of 1,000 at 5% simple interest earns a fixed 50 per year, producing 1,050, 1,100, 1,150, … and reaching 1,500 after 10 years. At 5% compound interest the sequence is geometric, 1000 × 1.05 n 1000 \times 1.05^n 1000 × 1.0 5 n , reaching 1,628.89 after 10 years. One is linear and the other exponential, so the gap grows with time; see the compound interest calculator for that model. These are illustrative numbers, not financial advice.
Assumptions
Constant difference : every adjacent pair has the same difference. If even one step differs, the formulas no longer describe the whole sequence.
Positive integer term count : the engine does not enforce this, so n = 2.5 n = 2.5 n = 2.5 produces a number with no discrete-sequence meaning.
Indexing starts at term 1 : a 1 a_1 a 1 is the first term, not term zero. Some textbooks or programs use zero-based indexing, where the corresponding form is a n = a 0 + n d a_n = a_0 + nd a n = a 0 + n d .
The sum means the first n n n terms : from a 1 a_1 a 1 through a n a_n a n . For terms m m m through n n n , use S n − S m − 1 S_n - S_{m-1} S n − S m − 1 .
UI solve-mode convention : blank fields enter the engine as 0, so while solving for n n n or d d d , the displayed sum is not the real sum until the solved value is entered back into the main field.
Scope and limitations Supported the nth term and first-n n n sum for real a 1 a_1 a 1 and d d d with positive integer n n n ; solving n n n from a n a_n a n when d ≠ 0 d \ne 0 d = 0 ; solving d d d when n ≠ 1 n \ne 1 n = 1 .
Model approximation real examples such as seats or inventory may only approximately follow a constant difference; the formula reports the model value. Not supported geometric sequences, second-order differences such as 1 , 3 , 6 , 10 , … 1, 3, 6, 10, \ldots 1 , 3 , 6 , 10 , … , an arbitrary partial sum a m + ⋯ + a n a_m + \cdots + a_n a m + ⋯ + a n in one operation, or solving n n n or d d d directly from S n S_n S n . Not provided listing every term or directly testing membership. To test whether a value belongs to the sequence, solve for n n n and check whether it is a positive integer.
Numerics very large sums may display in scientific notation. JavaScript double precision remains the underlying numerical representation.
Common pitfalls
Writing a 1 + n d a_1 + nd a 1 + n d : this misses the − 1 -1 − 1 and adds one extra d d d to every term. Six terms have only five gaps.
Treating a fractional solved n as a valid term number : n = 16.67 n = 16.67 n = 16.67 means the supplied last value is not a sequence term, not that there is a “16.67th term”.
Reading the solve-mode sum as a result : it is a fallback calculation using n = 0 n = 0 n = 0 or d = 0 d = 0 d = 0 . Enter the solved value back into its field before reading the real sum.
Using a positive difference for a decreasing sequence : 100, 93, 86, … has d = − 7 d = -7 d = − 7 , not 7.
Forgetting the division by 2 in the sum formula : n ( a 1 + a n ) n(a_1 + a_n) n ( a 1 + a n ) is the rectangle made from two staircase copies; one staircase is half of it.
Confusing geometric growth with arithmetic growth : compound interest, population growth and repeated multiplication require a geometric model.
Typical uses Teaching Move from a recurrence to a closed form, derive the sum by pairing, observe that the first n n n odd numbers sum to n 2 n^2 n 2 , and interpret an arithmetic sequence as a linear function sampled at integer points.
Counting and arrangements Rows of seats that increase regularly, layered stacks whose counts change by a fixed amount, and similar discrete arrangements.
Planning and budgeting Savings, repayment, inventory or training schedules that change by a fixed amount each period.
Simple interest and straight-line depreciation Simple interest accumulates by a fixed amount each period; straight-line depreciation reduces book value by a fixed amount, so the nth-period value follows the same arithmetic structure.
FAQ Why does the nth term show −1 when I first open the panel? The term count is empty, so the engine substitutes n = 0 n = 0 n = 0 into 1 + ( 0 − 1 ) × 2 = − 1 1 + (0-1) \times 2 = -1 1 + ( 0 − 1 ) × 2 = − 1 . Enter a term count and the display becomes meaningful.
How can I test whether a number is in the sequence? Clear n n n , enter the candidate as “nth term”, and check whether the solved n n n is a positive integer. In 5, 8, 11, …, 50 gives n = 16 n = 16 n = 16 , while 52 gives n = 16.67 n = 16.67 n = 16.67 and is not a term.
How do I sum terms 5 through 12? Compute S 12 S_{12} S 12 and S 4 S_4 S 4 and subtract. Alternatively, use term 5 as a new first term with a term count of 8.
If I know the sum, first term and common difference, how do I solve for n? Solve the quadratic equation d 2 n 2 + ( a 1 − d 2 ) n − S n = 0 \dfrac{d}{2}n^2 + \left(a_1 - \dfrac d2\right)n - S_n = 0 2 d n 2 + ( a 1 − 2 d ) n − S n = 0 and take a positive integer root. This inverse operation is not supported by the calculator.
Why does the sum grow quadratically? S n = n a 1 + n ( n − 1 ) 2 d S_n = n a_1 + \dfrac{n(n-1)}{2}d S n = n a 1 + 2 n ( n − 1 ) d contains an n 2 n^2 n 2 term. Geometrically, the sum is the area under a staircase whose top follows a straight line, so the area grows roughly with the square of the width.
How do I choose between an arithmetic and geometric sequence? Check whether adjacent terms have a constant difference or a constant ratio. Adding 50 each year is arithmetic; multiplying by 1.05 each year is geometric.
References and further reading
CalcX engine source src/data/formulas.ts, arithmetic-seq definition (compute(known, solveFor) produces an / sum and can solve n or d from an); all numerical examples on this page were recalculated with that engine.
Wikipedia, Arithmetic progression (访问日期:2026-09-09) — nth-term and sum formulas and derivations.
Wikipedia, 1 + 2 + 3 + 4 + ⋯ (访问日期:2026-09-09) — triangular numbers n ( n + 1 ) / 2 n(n+1)/2 n ( n + 1 ) /2 and the Gauss story.
Brian Hayes, “Gauss's Day of Reckoning” , American Scientist 94(3), 2006 (访问日期:2026-09-09) — historical examination of versions of the Gauss summation story.
Wikipedia, Rhind Mathematical Papyrus (访问日期:2026-09-09) — ancient arithmetic-allocation problems, including problems 40 and 64.
The Nine Chapters on the Mathematical Art , chapters on proportional and transport allocation — examples of arithmetic distribution and summation in the Chinese mathematical tradition.
Privacy All inputs and calculations stay in your browser and are not uploaded to a server. This explanatory page is static content and does not contain or record user input.
Sources & review
Reviewed by CalcX 编辑组
Updated 2026-09-09
Open Arithmetic Sequence Calculator: nth Term, Sum, Term Count and Common Difference in CalcX