(41) Fibonacci Decomposition (integer)
06-25-2022, 02:10 AM
Post: #2
 Thomas Klemm Senior Member Posts: 2,071 Joined: Dec 2013
RE: (41) Fibonacci Decomposition (integer)
This shorter program for the HP-42S may take a bit longer especially for bigger numbers:
Code:
00 { 27-Byte Prgm } 01▸LBL "FNS" 02 0 03 X<>Y 04 1 05▸LBL 00 06 X>Y? 07 GTO 01 08 STO+ ST Z 09 X<> ST Z 10 GTO 00 11▸LBL 01 12 R↓ 13 RCL- ST Y 14 END
It should work with the HP-41C as well after the obvious transformations.
You may want to add a VIEW Y command at the end.

Examples

65 XEQ "FNS"

y: 55
x: 10

R/S

y: 8
x: 2

R/S

y: 2
x: 0

Therefore: $$65 = 55 + 8 + 2$$

1000 XEQ "FNS"

y: 987
x: 13

R/S

y: 13
x: 0

Therefore: $$1000 = 987 + 13$$

References
 « Next Oldest | Next Newest »

 Messages In This Thread (41) Fibonacci Decomposition (integer) - SlideRule - 04-05-2020, 12:48 AM RE: (41) Fibonacci Decomposition (integer) - Thomas Klemm - 06-25-2022 02:10 AM RE: (41) Fibonacci Decomposition (integer) - Thomas Klemm - 06-25-2022, 08:15 AM

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