Sum of first n even numbers calculator
The first 5 even numbers, 2 + 4 + 6 + 8 + 10, add up to 30, because the sum of the first n even numbers is n(n + 1). Enter n and get the exact total without adding term by term. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 5
- Value
- 30
- Sum
- 30
The sum of the first n even numbers is one of the cleanest closed forms in elementary algebra: two plus four plus six and so on through two times n equals n times the quantity n plus one. That identity turns a long arithmetic series into a single quadratic evaluation that is exact for every positive integer n. This sum of first n even numbers calculator accepts a positive index, evaluates the polynomial with deterministic integer arithmetic, rejects values below one with a clear validation error, and returns both the total and the formula string so students, tutors, graders, and automation scripts share one trusted contract. Use it when you need a reliable total for homework checks, lesson demos, coding-interview sandboxes, or scripts that must never disagree with the textbook table of even-term sums.
Why 2 + 4 + … + 2n equals n times n plus one
By definition the sum of the first n even numbers is the partial sum S(n) equals two plus four plus six continuing through the term two times n. Every term is even, so you can factor two out of the series and write S(n) equals two times the sum of the first n positive integers. The triangular sum one plus two plus three through n is the familiar formula n times n plus one over two.
Multiplying by two cancels the denominator and leaves the compact closed form S(n) equals n times the quantity n plus one. Checking small positive integers recovers the table every algebra course builds by hand: S(1) is two, S(2) is six, S(3) is twelve, S(4) is twenty, S(5) is thirty, S(6) is forty-two, S(7) is fifty-six, S(8) is seventy-two, S(9) is ninety, and S(10) is one hundred ten.
The result is a quadratic polynomial in n, not a recurrence you must iterate from one, which is why the identity is useful in code, on paper, and in teaching materials that explain arithmetic series and even-term patterns. Discrete-mathematics courses reuse the same formula for counting arguments and parity exercises; programming contests use it whenever a constant-time sum of even numbers replaces an O(n) loop that would only recompute the closed form the slow way.
Where the calculator fits: classrooms, scripts, pricing, and limits
Use the browser tool when you want an immediate sum of even numbers while studying arithmetic series, checking a contest answer, or explaining the n times n-plus-one identity without installing a computer-algebra system. Accepted indexes run from one through ten million so classroom demos, large teaching tables, and Project-Euler-scale checks remain feasible without unbounded memory growth or multi-second loops. Results are fully deterministic: the same n always yields the same sum and the same value echo.
There is no language model, no external arithmetic service, and no randomness, so the capability is safe to pin in continuous-integration checks and reproducible lesson materials.
What you can do with it
Homework and contest verification
Students and graders confirm 2+4+…+2n for a given n without a local computer-algebra system or hand-written loops.
Arithmetic series lesson demos
Lesson pages that introduce even-term series can show n(n+1) beside worked values for small positive n.
Scripts and CI oracles
Automated checkers and interview sandboxes call a deterministic closed form instead of reimplementing the sum of even numbers in every language.
FAQ
What is the formula for 2 + 4 + … + 2n?
The standard closed form is n(n+1). This calculator evaluates that polynomial with exact integer arithmetic.
What happens if n is below 1?
Only positive integers n ≥ 1 are accepted and validation failures are not charged.
Is the sum of first n even numbers calculator free?
The browser tool runs free on your device.
Why use the closed form instead of looping over even terms?
The polynomial is exact for integer n and runs in constant time after validation. This calculator evaluates it with BigInt so large indexes stay precise without summing millions of terms.
How is the sum of even numbers related to the sum from 1 to n?
It is exactly twice that sum. Taking 2 out of 2 + 4 + … + 2n leaves 1 + 2 + … + n, which is n(n + 1)/2, so the even sum is n(n + 1). For 5 terms that gives 30.
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/algebra/sum-of-even-numbers \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":5}'const res = await fetch("https://api.kit.forhosting.com/algebra/sum-of-even-numbers", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/sum-of-even-numbers",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/sum-of-even-numbers", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/sum-of-even-numbers", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.sum_of_even_numbers",
"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.
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
The free browser path and the prepaid API path run the same pure module—no language model, no outbound network on the hot path, and no floating-point drift for ordinary classroom or contest sizes.
Input contract, validation rules, and response shape
The engine checks that n is present as a finite integer, is at least one, and stays within the published upper bound of ten million. On success it returns sum equal to n times n-plus-one, a formula field always set to the string n times open parenthesis n plus one close parenthesis for documentation and display, and a value field that echoes the same total so callers who prefer a generic name still see a stable label. There is no loop over even terms on the hot path: after validation the closed form is constant time. POST a JSON body with the required integer field n. Values of n below one fail immediately with invalid_input and are not charged; the same error path covers missing n, empty strings, non-integers, non-finite numbers, and values above the published maximum. Arithmetic uses BigInt so intermediate products never lose low-order bits for large indexes, and when the final result fits inside the safe JSON integer range it is returned as a number rather than a decimal string.
Where the calculator fits: classrooms, scripts, pricing, and limits
Each successful request is one billable item at $0.002; failed validation does not consume prepaid balance. Wire the endpoint into algebra demos, coding-interview sandboxes, discrete-math tutorials, integer preprocessing steps, or content pages that rank for sum of first n even numbers calculator search intent—anywhere you already prefer exact closed-form arithmetic over approximate heuristics or opaque black-box tools that cannot show the formula next to the total for two plus four through two-n.
Technical questions
How do I compute the sum of the first n even numbers with this API?
Send a JSON body with positive integer field n to algebra.sum_of_even_numbers. The response returns sum = n*(n+1), the formula string, and value (same as sum).