(35S) Fibonacci Fun for the HP35s and the number phi
01-24-2015, 09:53 AM (This post was last modified: 01-24-2015 09:54 AM by MarkHaysHarris777.)
Post: #9
 MarkHaysHarris777 Senior Member Posts: 333 Joined: Jan 2015
RE: Fibonacci Fun for the HP35s and the number phi
(01-24-2015 01:51 AM)Thomas Klemm Wrote:  This is what I came up with:
Code:
+ LASTX X<>Y

I assume this works on most classic HP calculators.

It does work to produce the Fibonacci sequence, but it does not meet my programming challenge because the numbers do not lift up the stack and out the TOP!

In other words at each iteration you will only have Fib numbers in X and y; z and t will contain zero. Without the REGX and REGY (hidden) instructions it takes at least five steps to generate the sequence in such a way that the numbers lift up the stack (bump up the stack and out the top) so that at any iteration past 4 the x,y,z,t stack regs will contain the last four Fib numbers in descending order as you move up the stack. So, at iteration 5 the stack will look like this:
t 1
z 2
y 3
x 5

Your algorithm will leave the stack looking like this after 5 iterations:
t 0
z 0
y 3
x 5

So just the equation REGX+REGY does the trick. Didier is correct to point out that the hidden REGx instructions are documented 'loosely' in Appendix B-7. And even so, the instructions are not very intuitive in their use, and secondarily they are painfully slow. Without the REGx instructions the minimum steps to bump the Fib numbers up the stack are five(5)
LASTx
X<>Y
+
LASTx
X<>Y

If not the intermediate results simply collapse back into the X and Y and the Z and T never get the replicated values.

Cheers

PS ... smile and wave boys, just smile and wave.

Kind regards,
marcus
 « Next Oldest | Next Newest »

 Messages In This Thread (35S) Fibonacci Fun for the HP35s and the number phi - MarkHaysHarris777 - 01-22-2015, 08:07 AM RE: Fibonacci Fun for the HP35s and the number phi - Massimo Gnerucci - 01-22-2015, 09:07 AM RE: Fibonacci Fun for the HP35s and the number phi - MarkHaysHarris777 - 01-22-2015, 09:39 AM RE: Fibonacci Fun for the HP35s and the number phi - Didier Lachieze - 01-22-2015, 10:56 AM RE: Fibonacci Fun for the HP35s and the number phi - MarkHaysHarris777 - 01-22-2015, 11:13 AM RE: Fibonacci Fun for the HP35s and the number phi - MarkHaysHarris777 - 01-23-2015, 07:08 AM RE: Fibonacci Fun for the HP35s and the number phi - Didier Lachieze - 01-23-2015, 07:34 AM RE: Fibonacci Fun for the HP35s and the number phi - Thomas Klemm - 01-24-2015, 01:51 AM RE: Fibonacci Fun for the HP35s and the number phi - MarkHaysHarris777 - 01-24-2015 09:53 AM RE: Fibonacci Fun for the HP35s and the number phi - Paul Dale - 01-24-2015, 10:03 AM RE: Fibonacci Fun for the HP35s and the number phi - MarkHaysHarris777 - 01-25-2015, 07:03 AM RE: Fibonacci Fun for the HP35s and the number phi - Thomas Klemm - 01-24-2015, 12:19 PM RE: Fibonacci Fun for the HP35s and the number phi - Paul Dale - 01-24-2015, 10:41 PM RE: Fibonacci Fun for the HP35s and the number phi - Thomas Klemm - 01-24-2015, 12:58 PM RE: (35S) Fibonacci Fun for the HP35s and the number phi - Gamo - 07-21-2018, 01:58 AM RE: (35S) Fibonacci Fun for the HP35s and the number phi - Thomas Klemm - 07-22-2018, 01:37 AM

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