# Fibonacci Number Calculator

> Computes the n-th Fibonacci number exactly with arbitrary-precision integers, together with F(n−1), F(n+1), the ratio F(n)/F(n−1) compared with the golden ratio, and optionally tests whether a given integer is a Fibonacci number.

- Calculator id: `fibonacci` · Category: Math (`math`) · Tool name: `calculate_fibonacci_number`
- Canonical page: https://tttkmbb.com/math/fibonacci · This document: https://tttkmbb.com/math/fibonacci.md · JSON definition: https://tttkmbb.com/math/fibonacci.json

## Purpose

Computes the n-th Fibonacci number exactly with arbitrary-precision integers, together with F(n−1), F(n+1), the ratio F(n)/F(n−1) compared with the golden ratio, and optionally tests whether a given integer is a Fibonacci number.

**Use when:** You need a specific Fibonacci number (exact, even with hundreds of digits), the terms around it, or want to check whether a number belongs to the sequence.

**Do not use when:** You need a general geometric or arithmetic progression (use geometric-sequence / arithmetic-sequence) or factorials and binomial coefficients (use factorial, combinations-permutations).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `n` | integer |  | required | Position in the sequence with F(0) = 0, F(1) = 1, F(2) = 1, F(3) = 2, … (min 0, max 500) |
| `check_number` | string |  | optional | Optional non-negative integer (as digits, any size) to test for membership in the Fibonacci sequence. |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `fibonacci` | string |  | The n-th Fibonacci number as an exact decimal string. |
| `fibonacci_number` | number |  | The same value as a number; omitted from F(74) on (above 2^50), where a number would no longer carry every digit. |
| `previous` | string |  | The preceding Fibonacci number (omitted for n = 0). |
| `next` | string |  | The following Fibonacci number. |
| `ratio` | number |  | Ratio of consecutive terms, which converges to the golden ratio (omitted for n ≤ 1). |
| `golden_ratio` | number |  | (1 + √5) / 2 = 1.6180339887…, the limit of the ratio. |
| `digits` | integer |  | Decimal digits of F(n). |
| `is_fibonacci` | boolean |  | true when 5·N² + 4 or 5·N² − 4 is a perfect square (only when check_number is given). |
| `check_index` | integer |  | The smallest k with F(k) = check_number (only when it is a Fibonacci number). |

## Formula

`F(0) = 0, F(1) = 1, F(n) = F(n − 1) + F(n − 2); φ = (1 + √5)/2; N is a Fibonacci number ⇔ 5N² + 4 or 5N² − 4 is a perfect square (Gessel's test)`

## Data Sources

- Wikipedia – Fibonacci sequence — https://en.wikipedia.org/wiki/Fibonacci_sequence (reference, retrieved 2026-09-24)
- OEIS A000045 – Fibonacci numbers — https://oeis.org/A000045 (reference, retrieved 2026-09-24)
- Wolfram MathWorld – Fibonacci Number — https://mathworld.wolfram.com/FibonacciNumber.html (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/fibonacci?n=…`
- `POST https://tttkmbb.com/api/v1/calculate/fibonacci` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/fibonacci · OpenAPI operationId `calculate_fibonacci_number` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "fibonacci", "inputs": {…}}`

## Example

- F(50), is 144 Fibonacci?: inputs `{"n":50,"check_number":"144"}` → `{"fibonacci":"12586269025","fibonacci_number":12586269025,"previous":"7778742049","next":"20365011074","ratio":1.6180339887,"golden_ratio":1.6180339887,"digits":11,"is_fibonacci":true,"check_index":12}`
- F(10): inputs `{"n":10}` → `{"fibonacci":"55","fibonacci_number":55,"previous":"34","next":"89","ratio":1.6176470588,"digits":2}`

```
GET https://tttkmbb.com/api/v1/calculate/fibonacci?n=50&check_number=144
```

## Limitations

You need a general geometric or arithmetic progression (use geometric-sequence / arithmetic-sequence) or factorials and binomial coefficients (use factorial, combinations-permutations). All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Does the sequence start with 0 or 1?**

This calculator uses the standard indexing F(0) = 0, F(1) = 1 (OEIS A000045), so F(10) = 55. Some texts start at F(1) = 1, F(2) = 1, which shifts the index by one.

**How large can n be?**

Up to 500: F(500) has 105 digits and is returned exactly as a string. The number output is omitted from F(74) on, because values above 2^50 cannot be returned as exact numbers.

## Related

- [Geometric Sequence Calculator](https://tttkmbb.com/math/geometric-sequence.md) — Fibonacci numbers grow like a geometric sequence with ratio φ.
- [Arithmetic Sequence Calculator](https://tttkmbb.com/math/arithmetic-sequence.md) — Sequences with a constant difference.
- [Factorial Calculator](https://tttkmbb.com/math/factorial.md) — Another fast-growing integer sequence.
