# HP Forums

Full Version: (11C) Tribonacci Sequence
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The Tribonacci Sequence is a generalization of the Fibonacci sequence where each term is the sum of the three preceding terms.

The sequence begins 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149,. . . .

Input the Nth number
Example: 7 A result 24
_______10 A result 149

Code:
``` LBL A STO 0 19  ENTER 33 √ 3 x -  3 1/X Y^X STO 1 33 √ 3 x 19 + 3 1/X Y^X STO 2 + 1 + 3 1/X x RCL 0 Y^X STO 3 RCL 1 RCL 2 + 1 + 4 ENTER 3 / x RCL 1 RCL 2 + 1 + X^2 9 1/X x - 1 - STO 4 RCL 3 RCL 4 / FIX 0 RTN```

Gamo
(12-14-2017 12:21 PM)Gamo Wrote: [ -> ]The Tribonacci Sequence is a generalization of the Fibonacci sequence where each term is the sum of the three preceding terms.

The sequence begins 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149,. . . .

Input the Nth number
Example: 7 A result 24
_______10 A result 149

Interesting formula. But implemented waaayyy too complicated. ;-)
Actually it's nothing more than u · vn with u and v being two constants.

Code:
```LBL C ENTER 1,839286755 STO 0 x<>y y^x RCL 0 4 x RCL 0 x^2 - 1 - / ,4 + INT RTN```

Or simply...

Code:
```LBL C ENTER 1,839286755 x<>y y^x ,336228117 x ,4 + INT RTN```

Dieter
I am a little confused as to how a tribonacci sequence can be a generalisation of a Fibonacci - though to be fair Wikipedia also uses that terminology.
I'd have thought a tribonacci would be a variation, but an n-bonacci capable of handling any number of summations would be a generalisation. But my main reason for posting isn't to quibble, but to enquire. I always find it helpful to think of applications to help focus upon the maths. Fibonacci always makes me think of rabbits, though I am sure that is not it's only use. Does the Tribonacci sequence have any practical use?
Here is the detail on Phi and Tribonacci on YouTube.

https://youtu.be/e7SnRPubg-g

Gamo
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :