(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
 SlideRule Senior Member Posts: 903 Joined: Dec 2013
(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 NumbersTo call the program, which is labeled "FN", from storage, press     GTO "FN"To calculate, for example, the 12th Fibonacci number, F12, press     12     R/SAfter about 1 second one sees the answer:    144,with a comma at the end.  Pressing     R/Sagain gives the 12th Lucas number, L12:     322 .with a period at the end (to distinguish it from the Fibonacci number and totell the user that the calculator is ready to accept the next index). Thecalculator is accurate up to F39 and L37 .Pressing the multiplication sign yields     F2n = Fn . Ln = 46368 (for n = 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 n = 12) ,where g  = 1.618 … is the Golden ratio, stored 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    RDNsubroutine for calculat-     11    LBL 11ing 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 28display Fn                   23    STOP                             24    RCL 03                             25    0.5                             26    +                             27    INT                             28    SF 28display Ln                   29    STOPready 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)
 « Next Oldest | Next Newest »

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