Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant
|
02-18-2017, 09:22 AM
(This post was last modified: 02-18-2017 09:26 AM by Ángel Martin.)
Post: #27
|
|||
|
|||
RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant
And here's the MCODE for this exercise. It includes four different functions, as follows:
1. FIB, the "straight' Fibonacci number. Enter n in X, result Fn in X and n in Lastx. 2. sFIB, partial sum of Fibonacci numbers. ("s" is the SIGMA char). Straight addition of all Fibonacci numbers up to n. 3. sIFIB, partial sum of the inverse of Fibonacci numbers, the subject of this thread. For n>=46 this is the PSI constant as Gerson explained. The execution time for n=46 is 2.87 seconds on a normal-speed HP-41. 4. FIBI, the "Fibonacci Inverse" Defined as F'n = 1/F'n-2 + 1/F'n-1. Note that this is not the same as the inverse of Fibonacci, which would simply be 1/Fn This last one is probably of no real interest but the code was "asking for it", if you know what I mean. Code:
Cheers, ÁM "To live or die by your own sword one must first learn to wield it aptly." |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)