The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(41) Fibonacci and Lucas Numbers
09-13-2019, 01:58 PM (This post was last modified: 09-13-2019 03:02 PM by SlideRule.)
Post: #1
(41) Fibonacci and Lucas Numbers
from Number Theory in Science and Communication, M.R. Schroeder, second enlarged edition, Springer-Verlag {pgs. 345-346}
PHP Code:
B.  A Calculator Program for Calculating Fibonacci and Lucas Numbers

To call the program
which is labeled "FN"from storagepress
     GTO 
"FN"
To calculate, for examplethe 12th Fibonacci numberF12press
     12
     R
/S
After about 1 second one sees the answer
:
    
144,
with a comma at the end.  Pressing
     R
/S
again gives the 12th Lucas number
L12:
     
322 .
with a period at the end (to distinguish it from the Fibonacci number and to
tell the user that the calculator is ready to accept the next index
). The
calculator is accurate up to F39 
and L37 .
Pressing the multiplication sign yields
     F2n 
= Fn . Ln 46368 (for 12) .
This rule comes in handy to calculate Fn for large even n.
     
The odd-index Fn are calculated by
     F2n
I  gF2n  75025  (for 12) ,
where g  1.618 … is the Golden ratiostored in register 02.
                Listing 
for "FN"
___________________________________________
Comment                      Step Code
___________________________________________
initialize by calculating    01    LBL 
"FN"
                             
02    5
                             03    SQRT
√5                           04    STO 01
                             05    1
                             06    
+
                             
07    0.5
                             08    •
Golden ratio                 09    STO 02
                             10    RDN
subroutine 
for calculat-     11    LBL 11
ing 
Fn and Ln                12    RCL 02
                             13    x 
< > Y
                             14    y
^x
                             15    STO 03
                             16    RCL 01
                             17    
/
                             
18    0.5
                             19    
+
                             
20    INT
                             21    FIX 0
                             22    CF 28
display 
Fn                   23    STOP
                             24    RCL 03
                             25    0.5
                             26    
+
                             
27    INT
                             28    SF 28
display Ln                   29    STOP
ready to start over          30    GTO 11
                             31    END 
real gems are yet to be revealed from 'obscure' sources.

BEST!
SlideRule

ps: follow-on to this thread, HP-41 Modulo function, in the General Forum HP Calculators (and very old HP Computers)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(41) Fibonacci and Lucas Numbers - SlideRule - 09-13-2019 01:58 PM



User(s) browsing this thread: 1 Guest(s)