Tribonacci Number Calculator

Find any Tribonacci number Tₙ.

How it is calculated

The tool uses the recurrence T(n) = T(n−1) + T(n−2) + T(n−3) with the starting values T(0) = 0, T(1) = 0, T(2) = 1. It computes terms one by one with a loop, so there is no rounding error for the sizes it allows.

The index n must be a whole number from 0 to 60; decimals are cut off and anything outside that range gives no result. Beware that sources start the sequence differently (0, 0, 1 or 0, 1, 1 or 1, 1, 2). This tool starts with 0, 0, 1, so its n may be offset from a book or table using another convention. The result is shown as a whole number with thousands separators.

Worked example

Find T(10). Starting 0, 0, 1: T(3) = 0+0+1 = 1, T(4) = 0+1+1 = 2, T(5) = 1+1+2 = 4, T(6) = 1+2+4 = 7, T(7) = 2+4+7 = 13, T(8) = 4+7+13 = 24, T(9) = 7+13+24 = 44, and T(10) = 13+24+44 = 81.

Try this example →

Common mistakes

  • Comparing with a table that starts at 1, 1, 2 or 0, 1, 1. The same number can then appear at a different index, so check the starting values before comparing.
  • Counting from 1 instead of 0. The first term is n = 0, so "the tenth term" is n = 9.
  • Expecting the ratio of terms to approach the golden ratio. For Tribonacci it approaches about 1.839, the tribonacci constant.
  • Entering a very large n. The tool stops at 60 because larger values lose exactness in floating-point arithmetic.

About this calculator

The Tribonacci sequence generalizes the Fibonacci idea one step further: instead of adding the previous two terms, each term is the sum of the previous three (T₀=0, T₁=0, T₂=1, and Tₙ = Tₙ₋₁ + Tₙ₋₂ + Tₙ₋₃ from there on). As n grows, the ratio of consecutive terms converges to the tribonacci constant (≈1.839286755), the real root of x³ = x² + x + 1, playing a role for this sequence similar to what the golden ratio plays for Fibonacci numbers.

Computer science students meet it in recursion and dynamic-programming exercises (it's a classic LeetCode-style problem), while number theorists and recreational mathematicians use it to explore generalized Fibonacci-like sequences (tetranacci, pentanacci, and beyond follow the same pattern with more terms).

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    A good sanity check is the ratio of neighbouring terms. T(20) is 35,890 and T(19) is 19,513, and their quotient is about 1.8393, already very close to the tribonacci constant. If your own table disagrees with the tool, compare the first few terms before suspecting an error; this tool begins 0, 0, 1. Have you used this sequence in a coding exercise, and which version of the starting values did it expect?

Popular calculators

All Calculators