HP Forums
(10C) (11C) Fibonacci Numbers (Tom Grydeland) (10C and 11C) - Printable Version

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (10C) (11C) Fibonacci Numbers (Tom Grydeland) (10C and 11C) (/thread-8352.html)



(10C) (11C) Fibonacci Numbers (Tom Grydeland) (10C and 11C) - Eddie W. Shore - 05-15-2017 01:16 PM

Today’s program is courtesy of Tom Grydeland. This is his Fibonacci number program for the HP-10C and HP-11C.

Here is what Tom wrote to me:

Dear sir,

In response to your blog post on Fibonacci numbers for the HP-15C:

For the HP-11C, the DSE instruction (and ISG also) references register
I only. Therefore, to run Joe Horn's program on the 11C, replace step
002 (STO 0) with '44, 25' (STO I), and step 010 (DSE 0) with '42, 5'
(DSE).

For the HP-10C, there are no ISG or DSE instructions, nor labels. The
program becomes (tested)

Code:
Step    Key Code        Mnemonic
001     1               (1)
002     34              (X<>Y)
003     0               (0)
004     34              (X<>Y)
005     1               (0)
006     30              (-)
007     44 0            (STO 0)
008     33              (Rv)
009     40              (+)
010     42 36           (LST X)
011     34              (X<>Y)
012     45 0            (RCL 0)
013     42 20           (X=0?)
014     22 16           (GTO 16)
015     22 05           (GTO 05)
016     33              (Rv)
017     22 00           (GTO 00 == STOP)

thank you and best regards.

Credit and thanks to Tom Grydeland


RE: Fibonacci Numbers (Tom Grydeland) (10C and 11C) - grsbanks - 05-15-2017 03:59 PM

This also works for the HP-12C:

Code:
01-        1    (1)
02-       34    (x<>y)
03-        0    (0)
04-       34    (x<>y)
05-        1    (1)
06-       30    (-)
07-    44  0    (STO 0)
08-       33    (Rv)
09-       40    (+)
10-    43 36    (LSTx)
11-       34    (x<>y)
12-    45  0    (RCL 0)
13-    43 35    (x=0)
14- 43,33 16    (GTO 16)
15- 43,33 05    (GTO 05)
16-       33    (Rv)
17- 43,33 00    (GTO 00)

Dump for SwissMicros DM12(L):

Code:
DM12
00  05000000000000  03000000000000  00000000000000  00000000000000
04  e17b4333f00b00  00000000000008  0000000000000c  00000000000000
08  00000000000000  103a0daa880c80  bef30200e8ba80  00000000000000
e8  00000000000000  00000000000000  05000000000000  00000000000000
f8  00000000000000  00000000000000  00000000000000  000000000000dc
fc  0516c40da5d5b4  dc0cb21fa50fa5  1f000000d85b1c  00000000000000
A: e17b4333f00b00  B: 00010000000000  C: ffffffffffffff
M: f16bfffff33b0b  N: 08000000000000  G: 42



RE: Fibonacci Numbers (Tom Grydeland) (10C and 11C) - Gerson W. Barbosa - 05-15-2017 09:51 PM

(05-15-2017 03:59 PM)grsbanks Wrote:  This also works for the HP-12C:

Code:
01-        1    (1)
02-       34    (x<>y)
03-        0    (0)
04-       34    (x<>y)
05-        1    (1)
06-       30    (-)
07-    44  0    (STO 0)
08-       33    (Rv)
09-       40    (+)
10-    43 36    (LSTx)
11-       34    (x<>y)
12-    45  0    (RCL 0)
13-    43 35    (x=0)
14- 43,33 16    (GTO 16)
15- 43,33 05    (GTO 05)
16-       33    (Rv)
17- 43,33 00    (GTO 00)

Saving one step:
Code:

01-    44  0    (STO 0)
02-        1    (1)
03-    43 23    (LN)
04-    43 36    (LSTx)
05-       34    (x<>y)
06-       40    (+)
07-        1    (1)
08- 44 30  0    (STO- 0)
09-       33    (Rv)
10-    45  0    (RCL 0)
11-    43 35    (x=0)
12- 43,33 15    (GTO 15)
13-       33    (Rv)
14- 43,33 04    (GTO 04)
15-       34    (x<>y)
16- 43,33 00    (GTO 00)

Further optimization is still possible.

Gerson.


RE: Fibonacci Numbers (Tom Grydeland) (10C and 11C) - bshoring - 05-15-2017 10:47 PM

Here's the listing for HP-38 E/C or RPN-38 CX based on Gerson's last entry:

Code:

01 - 21 0        STO 0
02 - 1            1
03 - 25 23        LN
04 - 25 31        LASTx
05 - 33          x≷y
06 - 51          +
07 - 1            1
08 - 21 41 0      STO − 0
09 - 25 33        R↓
10 - 22 0        RCL 0
11 - 25 6        x=0
12 - 25 7 15      GTO 15
13 - 25 33        R↓
14 - 25 7 04      GTO 04
15 - 33          x≷y
16 - 25 7 00      GTO 00



RE: Fibonacci Numbers (Tom Grydeland) (10C and 11C) - Gerson W. Barbosa - 05-16-2017 01:05 AM

(05-15-2017 10:47 PM)bshoring Wrote:  Here's the listing for HP-38 E/C or RPN-38 CX based on Gerson's last entry:

Code:

01 - 21 0        STO 0
02 - 1            1
03 - 25 23        LN
04 - 25 31        LASTx
05 - 33          x≷y
06 - 51          +
07 - 1            1
08 - 21 41 0      STO − 0
09 - 25 33        R↓
10 - 22 0        RCL 0
11 - 25 6        x=0
12 - 25 7 15      GTO 15
13 - 25 33        R↓
14 - 25 7 04      GTO 04
15 - 33          x≷y
16 - 25 7 00      GTO 00

One listing for the RPN-38CX might be

Code:

01 - 26           x≷I
02 - 1            1
03 - 25 23        LN
04 - 22 51 31     RCL + LASTx
05 - 24 26        DSE
06 - 25 7 04      GTO 04
07 - 25 7 00      GTO 00

Best regards,

Gerson.


RE: Fibonacci Numbers (Tom Grydeland) (10C and 11C) - bshoring - 05-17-2017 02:40 AM

Gerson, that's even better. Using RCL + LastX and the new DSE function !

Thanks!