Tetranacci number calculator
Starting from 0, 0, 0 and 1 and adding the last four terms each time, position 10 holds 56. Enter a position to get its exact tetranacci number, with every digit kept even for very large positions. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 10
- Value
- 56
- Digits
- 2
The tetranacci sequence is the four-step cousin of Fibonacci and Tribonacci: each term is the sum of the previous four. With the standard seeds T(0)=0, T(1)=0, T(2)=0 and T(3)=1, the run begins 0, 0, 0, 1, 1, 2, 4, 8, 15, 29, 56, 108 and continues by that same four-term rule. This calculator accepts a single non-negative integer n and returns the exact n-th tetranacci number as a decimal string, so large indices stay exact instead of rounding away in a floating-point mantissa.
What a tetranacci number is, and how it differs from nearby sequences
A tetranacci number is a term of the linear recurrence that adds the previous four values rather than two or three. After the four seeds T(0)=0, T(1)=0, T(2)=0 and T(3)=1, every later term obeys T(n) = T(n-1) + T(n-2) + T(n-3) + T(n-4). The opening stretch is therefore 0, 0, 0, 1, 1, 2, 4, 8, 15, 29, 56, 108, 208, 401, 773, 1490, 2872, 5536, 10671, 20569, 39648 — the convention catalogued as OEIS A000078 and used by this calculator.
That is not the tetrahedral figurate sequence Te_n = n(n+1)(n+2)/6, which counts stacked triangular numbers and answers a different search. It is also not the Fibonacci two-step recurrence or the Tribonacci three-step recurrence: those landings exist for those queries. The characteristic polynomial of this four-step rule is x^4 − x^3 − x^2 − x − 1 = 0.
Its dominant real root, the tetranacci constant, is about 1.92756, and the ratio T(n+1)/T(n) approaches that constant, so the terms grow exponentially but more slowly than a pure power of two. Combinatorially, T(n+3) counts the compositions of n whose parts lie in {1, 2, 3, 4}, or equivalently the ways to tile a board of length n with tiles of those lengths.
Where a tetranacci calculator earns its keep
Classrooms and contest coaches use a tetranacci calculator so learners can check the four-step recurrence without building a rolling sum by hand or trusting an opaque pasted list. Notebooks that need tiling counts or four-part composition coefficients can call the contract once per cell and keep the returned digit count for an audit column. Recreational number-theory pages that already cover Fibonacci and Tribonacci can add this four-step sibling without standing up a computer-algebra system.
Pair this tool with a Fibonacci or Tribonacci calculator when you want the two-step or three-step cousins, and with a tetrahedral-number calculator when the search was for stacked triangles rather than a four-term recurrence.
What you can do with it
Classroom checks of the four-term recurrence
Let students submit n and compare the exact T(n) string against a hand-rolled loop, so off-by-one seed mistakes surface immediately.
Tiling and composition counts
Use T(n+3) as the number of ways to write n as an ordered sum of 1s, 2s, 3s and 4s, or to tile a length-n board with those tiles.
FAQ
What seeds and rule does this tetranacci calculator use?
Seeds T(0)=0, T(1)=0, T(2)=0, T(3)=1, then each later term is the sum of the previous four: T(n)=T(n-1)+T(n-2)+T(n-3)+T(n-4). That is OEIS A000078: 0, 0, 0, 1, 1, 2, 4, 8, 15, 29, 56, …
What happens if n is negative?
Tetranacci is defined here for n ≥ 0 only; a negative index is rejected rather than extended backwards.
Is a tetranacci number the same as a tetrahedral number?
No. Tetrahedral numbers follow the closed form n(n+1)(n+2)/6. Tetranacci numbers follow a four-term linear recurrence. They answer different searches.
What is the 10th tetranacci number?
Counting positions from zero with the standard start 0, 0, 0, 1, the value at position 10 is 56. The terms leading up to it are 1, 2, 4, 8, 15 and 29.
What do tetranacci numbers count?
They count tilings. The term three places further on gives the number of ways to cover a strip of a given length with tiles of length 1, 2, 3 or 4.
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/numth/tetranacci \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":10}'const res = await fetch("https://api.kit.forhosting.com/numth/tetranacci", {
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/numth/tetranacci",
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/numth/tetranacci", 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/numth/tetranacci", 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": "numth.tetranacci",
"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 | 10000 |
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
A negative n is rejected with invalid_input, because the recurrence is defined only for n at least zero.
What a tetranacci number is, and how it differs from nearby sequences
This endpoint returns one exact term as a decimal string, together with the digit count and the recurrence formula, not a plot and not a generating-function expansion.
Input contract, algorithm, and the range that stays exact
Negative indices are out of scope on purpose: the recurrence is stated for n greater than or equal to zero, and inventing a backward extension would silently disagree with the OEIS listing this page is built to match. After n is accepted the engine walks a constant-space loop that carries four BigInt registers and advances them from the seeds up to the requested index. Prefer a Fibonacci calculator when you want the two-term sequence, a Tribonacci calculator when you want three addends, and a tetrahedral-number calculator when you want the figurate closed form. This page answers only the four-term lookup. POST a JSON body with the required integer field n, or use the aliases index or k. The value may arrive as a JSON number, a decimal digit string, or a bigint. Fractions, booleans, empty strings, scientific notation, values above the published ceiling of ten thousand, and any negative n fail with invalid_input naming the field. Values are returned as decimal strings because T(n) outgrows a safe IEEE integer well before the ceiling: a string keeps every digit exact in JSON.
Where a tetranacci calculator earns its keep
Exam generators need a deterministic oracle that rejects a negative n instead of inventing a term, because a buggy grader might treat an empty success payload as a valid classification. Keep n a non-negative integer at most ten thousand, treat invalid_input as a client fix rather than a retry, and store both the decimal string and the digit count if you later compare implementations.
Integration use cases
Deterministic OEIS A000078 fixtures
Pin known terms such as T(10)=56 and T(20)=39648 in unit tests without embedding a static dump of the whole sequence.
Technical questions
Why is the value a decimal string instead of a JSON number?
T(n) outgrows a safe JavaScript integer well before the published ceiling. A decimal string keeps every digit exact for large n.
What does the tetranacci number calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.