Sum of Fibonacci series
The first 10 Fibonacci numbers add up to 143, which is F(12) minus 1. Enter how many terms to add, up to 1000, and get the exact sum and the list of terms, checked against the F(n+2) − 1 identity every time. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 10
- Sum
- 143
- F n
- 55
- F n plus 2
- 144
- Identity
- sum(F1..Fn) = F(n+2) - 1
The Fibonacci sequence is the classic integer series where each term after the second is the sum of the two preceding ones. With the common educational indexing F(1)=1, F(2)=1, F(3)=2, F(4)=3, F(5)=5, and so on, a frequent homework and interview question is to add the first n terms. That partial sum is not an ad-hoc loop only: it equals F(n+2) minus one, a closed identity that doubles as a self-check. This calculator accepts a positive integer n, builds the first n Fibonacci numbers exactly, returns their sum, lists the sequence, and confirms the total against F(n+2)−1 so you can trust both the iterative path and the formula. Values of n below one are rejected with a clear validation error.
What the sum of the first n Fibonacci numbers means
Write the Fibonacci sequence as F(1)=1, F(2)=1, and F(k)=F(k−1)+F(k−2) for every integer k greater than or equal to three. The first n terms are then the finite list F(1), F(2), …, F(n). The same totals appear in contest problems, coding interviews, and discrete-mathematics courses that introduce recurrence relations.
A remarkable fact is that S(n) never needs an independent formula memorized from scratch once you know one more Fibonacci value: S(n) equals F(n+2) minus one. Checking a few small cases makes the identity memorable: F(3)−1=2−1=1, F(4)−1=3−1=2, F(5)−1=5−1=4, F(7)−1=13−1=12. The proof is a short induction or a telescoping argument using the defining recurrence.
Because both the iterative sum and the closed form must agree, any implementation that returns one without matching the other is wrong. This capability always computes both paths and refuses to emit a result if they diverge, which is why it is safe to pin in automated tests and reproducible notebooks.
How this calculator evaluates the Fibonacci partial sum
Call the capability with a single required field n holding a positive integer from one through one thousand. The engine validates that n is present, finite, integral, and not below one. After validation, the core walks a pure BigInt recurrence that emits F(1) through F(n), accumulates their sum, and records the ordered sequence in the response.
Independently it evaluates F(n) and F(n+2) with the same recurrence definition and checks that the accumulated sum equals F(n+2)−1 and that the last listed term equals F(n).
Practical use, limits, pricing, and delivery
Use the browser tool when you want an immediate partial sum while studying recurrences, checking a contest answer, or explaining the F(n+2)−1 identity without installing a computer-algebra system. Accepted inputs are positive integers up to one thousand so large teaching demos remain feasible without unbounded memory growth. Results are fully deterministic: the same n always yields the same sum, the same sequence, the same F(n), and the same F(n+2).
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 the sum of the first n Fibonacci numbers and inspect the sequence plus the F(n+2)−1 check without a local CAS.
Teaching the closed Fibonacci-sum identity
Lesson pages that introduce S(n)=F(n+2)−1 can show the iterative total beside F(n+2) so learners connect recurrence to the closed form.
FAQ
What happens if n is below 1?
Only positive integers n ≥ 1 are accepted; zero and negatives are rejected and not charged.
Which Fibonacci indexing does this use?
F(1)=1, F(2)=1, F(3)=2, and so on. The first term counted is F(1), not F(0).
Is the Fibonacci series sum calculator free?
The browser tool runs free on your device.
Why does the sum equal F(n+2) − 1?
It is a classical Fibonacci identity. This calculator computes the iterative sum and F(n+2)−1 independently and requires them to match before returning a result.
What is the sum of the first 5 Fibonacci numbers?
It is 12, because 1 + 1 + 2 + 3 + 5 makes 12. The identity agrees: F(7) is 13, and 13 minus 1 is 12, so both routes give the same answer.
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/fibonacci-sum \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":10}'const res = await fetch("https://api.kit.forhosting.com/math/fibonacci-sum", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/fibonacci-sum",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/fibonacci-sum", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/fibonacci-sum", 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": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.fibonacci_sum",
"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
max_n | 1000 |
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
What the sum of the first n Fibonacci numbers means
Their sum S(n) is simply that list added together: for n=1 you get 1; for n=2 you get 1+1=2; for n=3 you get 1+1+2=4; for n=5 you get 1+1+2+3+5=12; for n=10 you get 143.
How this calculator evaluates the Fibonacci partial sum
Integers outside the published upper bound fail with invalid_input rather than silently truncating. Terms that fit inside JavaScript safe integers are returned as JSON numbers; larger exact values appear as decimal strings so classroom examples with bigger n stay exact. Missing n, non-integers, zero, negatives, and values above the maximum all fail with invalid_input and are not charged.
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 number-theory demos, coding-interview sandboxes, discrete-math tutorials, or integer preprocessing steps where you already prefer exact Fibonacci arithmetic over approximate heuristics or opaque black-box calculators that cannot show the identity.
Integration use cases
Interview and coding-exercise oracles
Practice platforms can call a deterministic oracle that returns sum and sequence for positive n and rejects invalid n with a stable error code.
Technical questions
How do I sum the first n Fibonacci numbers with this API?
Send a JSON body with positive integer field n to math.fibonacci_sum. The response returns sum, sequence, f_n, f_n_plus_2, and the identity string.