04-05-2020, 11:20 AM
Pages 345 & 346 from Number Theory in Science and Communication, Second Enlarged Edition, © Springer·Verlag Berlin Heidelberg 1984 and 1986, ISBN 978-3-662-22246-1 (eBoook)
"B. A Calculator Program for Calculating Fibonacci and Lucas Numbers
To call the program, which is labeled "FN", from storage, press
GTO "FN"
To calculate, for example, the 12th Fibonacci number, F12, press
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 n = 12) .
This rule comes in handy to calculate Fn for large even n.
The odd-index Fn are calculated by
F2n+1 = 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 calculat-
ing two constants 01 LBL "FN"
02 5
03 SQRT
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"
BEST!
SlideRule
corrected spelling errors
"B. A Calculator Program for Calculating Fibonacci and Lucas Numbers
To call the program, which is labeled "FN", from storage, press
GTO "FN"
To calculate, for example, the 12th Fibonacci number, F12, press
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 n = 12) .
This rule comes in handy to calculate Fn for large even n.
The odd-index Fn are calculated by
F2n+1 = 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 calculat-
ing two constants 01 LBL "FN"
02 5
03 SQRT
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"
BEST!
SlideRule
corrected spelling errors