ForHosting KIT · Math

Sum of first n even numbers

Add 2 + 4 + … + 2n in one step with the formula n(n + 1): with n of 5 the total is 30, and the result stays an exact whole number for any n up to ten million. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Positive integer n
5
You get
Value
30
Sum
30

The sum of the first n even numbers is a classic closed form that every pre-algebra and discrete-mathematics student meets early: two plus four plus six and so on up to two-n equals n times n plus one. That identity turns a loop over even terms into a single quadratic polynomial that is always exact for positive integer n. This calculator evaluates the formula with deterministic integer arithmetic for any accepted positive index, rejects n below one with a clear validation error, and returns both the numeric sum and the formula string so homework checkers, scripts, and lesson pages can trust a single contract.

The formula for the sum of the first n even numbers

By definition the sum of the first n even numbers is S(n) equals two plus four plus six continuing through two times n. Factoring two out of each term produces S(n) equals two times the sum of the first n positive integers, and that triangular sum is n times n plus one over two, so the twos cancel and the compact closed form is simply S(n) equals n times the quantity n plus one.

Substituting small positive integers recovers the familiar table: 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. Algebra courses use this identity when they introduce arithmetic series and even-term patterns, discrete-mathematics courses use it for counting arguments and parity exercises, and programming contests use it whenever a solution needs a constant-time sum of even numbers instead of an O(n) loop.

Understanding that the result is a quadratic polynomial in n, not a recurrence you must iterate from one, is the first step to using the formula confidently in code, on paper, and in teaching materials that explain why two plus four through two-n collapses so cleanly.

Practical use, limits, pricing, and delivery

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(n+1) 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. 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.

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.

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.

Is n the number of even terms or the last even number?

The number of terms. With n equal to 10 you add ten even numbers, from 2 up to 20, so the last term is always twice n, and the total is 110.

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.

POSThttps://api.kit.forhosting.com/math/sum-of-even

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.

curl -X POST https://api.kit.forhosting.com/math/sum-of-even \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":5}'
{
  "n": 5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.sum_of_even",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n10000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How this calculator validates n and evaluates the closed form

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, then returns sum equal to n times n-plus-one, together with the formula string for documentation and a value field that echoes the same result so callers who prefer a generic name see both labels. There is no loop over even terms on the hot path: the closed form is constant time after validation. Send 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, non-integers, non-finite numbers, and values above the published maximum. Arithmetic uses BigInt so intermediate products never lose low-order bits, and when the final result fits inside the safe JSON integer range it is returned as a number rather than a decimal string.

Practical use, limits, pricing, and delivery

Each successful request is one billable item at $0.002; failed validation does not consume balance. Wire the endpoint into algebra demos, coding-interview sandboxes, discrete-math tutorials, or integer preprocessing steps where you already prefer exact closed-form arithmetic over approximate heuristics or opaque black-box calculators that cannot show the formula or the definition as two plus four up through two-n.

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 math.sum_of_even. The response returns sum = n*(n+1), the formula string, and value (same as sum).

Read the full KIT documentation →