How to check if a number is tribonacci number or not?

487 Views Asked by At

The Tribonacci sequence is an extension of the Fibonacci sequence where each term is the sum of the previous three terms.

The Tribonacci sequence: 0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149, 274, 504, 927, 1705,...........

So given a number, can we check if that number is Tribonacci number or not?

I tried but not able to find any formula, I know that Fibonacci number can be checked directly using a formula.

2

There are 2 best solutions below

0
On

Small values can be checked directly.

For sufficiently large values (somewhere around $>200$ or so), $n$ is Tribonacci if and only if $a^m$ rounds to $n$ for some integer $m$, where $$a = \frac 13 \left(1 + \sqrt[3]{19 - 3 \sqrt{3}} + \sqrt[3]{19 + 3 \sqrt{3}}\right),$$ and this can be easily checked by taking logarithms.

0
On

So firstly, let us study about the tribonacci constant (analogy of $\Phi$ of the Fibonacci series) i am giving here without proof the value-$$k=\frac{1+ \sqrt[3]{19+3\sqrt{33}}+\sqrt[3]{19-3\sqrt{33}}}{3} \approx 1.839$$ which is simply a root of the polynomial $x^3 -x^2 -x -1$ you can understand this constant as the converging ratio of any two consecutive numbers of the series.

Now, here is a formula for nth tribonacci numbers which I am giving without proof$$T(n)=\left \lfloor 3b \frac{\left(\frac{1}{3}(a_+ + a_- +1)\right)^n}{b^2 -2b +4} \right \rceil \\ \text{where $\lfloor \rceil$ denotes nearest integer function} \\ a_\pm = \sqrt[3]{19 \pm 3\sqrt{33}} \\ b = \sqrt[3]{586 +102\sqrt{33}}$$ to check if a number is tribonacci or not, just solve for n and conclude