Arithmetic sequence calculator
Start at 2 and add 3 each time: the fifth term is 14, and the first five terms add up to 40. Enter the first term, the common difference and a position to get that term and the running total together. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 2
- D
- 3
- N
- 5
- Term
- 14
- Sum
- 40
An arithmetic sequence (also called an arithmetic progression) is a list of numbers where each term after the first is formed by adding a fixed common difference. Negative first terms, negative differences, zero difference (a constant sequence), and fractional steps are all supported as long as values stay finite. Indices below one are rejected with a clear validation error so homework tools and scripts cannot silently treat a zeroth term as valid under this convention.
How the n-th term and partial sum are defined
An arithmetic progression is completely determined by its first term a and its common difference d. The sequence reads a, a plus d, a plus two d, a plus three d, and so on. For a quick check, take a equals two, d equals three, and n equals five: the terms are two, five, eight, eleven, fourteen; the fifth term is fourteen and the sum is forty.
Another check with a decreasing sequence: a equals ten, d equals negative two, n equals four yields terms ten, eight, six, four; the fourth term is four and the sum is twenty-eight. Constant sequences are allowed when d is zero: every term equals a and S_n equals n times a.
Where arithmetic sequences show up in real work
Data and analytics demos sometimes use evenly spaced ladders as synthetic load levels, price steps, or schedule offsets; computing the n-th value and the cumulative sum in one call keeps those ladders honest. Finance-style storytelling about linear growth or fixed decrements is easier to illustrate when term and sum are returned together rather than forcing a second pass. If you later need geometric progressions, recursive sequence solvers, or interpolation of a missing middle term from three known values, treat those as separate search intents rather than overloading this arithmetic-sequence landing.
What you can do with it
Evenly spaced ladders in demos
Generate linear sequences for load-test levels, pricing steps, or schedule offsets and obtain both the selected step and the cumulative total.
FAQ
What formulas does this arithmetic sequence calculator use?
The n-th term is a + (n − 1)·d. The partial sum of the first n terms is S_n = n/2 · (2a + (n − 1)·d). Indexing is 1-based.
What happens if n is below 1?
The term index n must be at least 1 under this convention.
Are fractional first terms and differences allowed?
Yes. a and d may be any finite numbers (including decimals). n must still be an integer between 1 and 1,000,000.
What does it cost?
The browser tool is free and runs locally.
Can the sequence go down instead of up?
Yes, use a negative common difference. Starting at 10 and subtracting 2 gives 10, 8, 6 and 4, so the fourth term is 4 and the sum of those four terms is 28.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/arithmetic-sequence \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":2,"d":3,"n":5}'const res = await fetch("https://api.kit.forhosting.com/math/arithmetic-sequence", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 2,
"d": 3,
"n": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/arithmetic-sequence",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 2,
"d": 3,
"n": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/arithmetic-sequence", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":2,"d":3,"n":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":2,"d":3,"n":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/arithmetic-sequence", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 2,
"d": 3,
"n": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.arithmetic_sequence",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
min_n | 1 |
max_n | 1000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Given the first term a, the common difference d, and a positive integer index n, this calculator returns the exact n-th term and the sum of the first n terms using the closed-form formulas taught in algebra: a_n equals a plus (n minus one) times d, and S_n equals n over two times the quantity two a plus (n minus one) times d. The free browser tool and the paid API share one pure function, so classroom demos and automated pipelines never silently diverge.
How the n-th term and partial sum are defined
Using one-based indexing, the n-th term is therefore a_n equals a plus (n minus one) times d. That single multiplication replaces iterating n steps and is the formula students meet in textbooks when they are asked for a specific term without writing the whole list. The partial sum of the first n terms, written S_n, is the sum a plus a_2 plus ellipsis plus a_n. There is a closed form that avoids adding term by term: S_n equals n over two multiplied by the quantity two a plus (n minus one) times d, which is algebraically the same as n times the average of the first and last terms.
What you send and what you get back
The error for n below one states that the term index must be at least one so form clients and scripts can correct the input without guessing. Example: a equals two, d equals three, n equals five returns term fourteen and sum forty. Example: a equals five, d equals zero, n equals three returns term five and sum fifteen. Example: a equals one point five, d equals zero point five, n equals four returns term three and sum nine. Provide three fields: a (aliases first, a1, first_term) for the first term, d (aliases difference, common_difference) for the common difference, and n (aliases number, index, term) for the one-based term index. a and d may be any finite numbers, including negatives and decimals; n must be an integer from one through one million inclusive. Missing fields, non-numeric values, NaN, Infinity, non-integer n, and any n below one are rejected with invalid_input and are not charged. On success the response echoes the normalized a, d, and n, and adds term (the n-th term) and sum (the partial sum of the first n terms). API pricing is the published base of $0.002 per successful item; failed validation does not consume balance.
Where arithmetic sequences show up in real work
Product teams building education apps need a deterministic endpoint that matches the classroom convention (first term is term one, n less than one is invalid) so their UI never disagrees with the API on edge cases. Because this capability is a pure parse engine, it runs fully in the browser for free interactive use and on the Worker path for automation at $0.002 per successful item.
Integration use cases
Homework and contest answer keys
Compute the n-th term and the sum of the first n terms for algebra problems, olympiad fixtures, and automated grading with a single deterministic call.
Teaching closed-form formulas
Show students that a_n and S_n match the textbook identities for positive, negative, and zero common differences without iterative addition mistakes.
Technical questions
Can the common difference be negative or zero?
Yes. Negative d produces a decreasing sequence; d = 0 is a constant sequence where every term equals a and S_n = n·a.