HP 25 Fibonacci sequence in one program step

10142021, 10:03 AM
(This post was last modified: 10142021 10:05 AM by C.Ret.)
Post: #21




RE: HP 25 Fibonacci sequence in one program step
(10132021 04:42 PM)Gerson W. Barbosa Wrote: RPN: Y, Z, T < k1; X <k2 Then * * * … and Thank to remind me this old matrix arithmetic multiplication on RPL. I remember a few decade when I try to use power exponentiation of [[1 1][1 0]] to the n to directly get Fn value. Hard time discovering sadly that the matrix exponentiation on the HP28C/S doesn't work with ^ instruction. (10132021 06:26 PM)Dave Britten Wrote: I think you guys have figured out the gist of it. OK, now I can publish my completed trace print. (10132021 07:35 PM)David Hayden Wrote:(10132021 07:11 PM)Gerson W. Barbosa Wrote: 0 1 + Then repeat RCL + ST LThat's it! I can't applied this trick neither on my HP41C that miss memory recall arithmetic, nor on my HP15C who have recall arithmetic but no stack register manipulation. The amazing HP 42S (or succedanea DM 42S or Free 42) is really a blend of the two anthology systems. At least, like the HP25, the HP41 and HP15C need a two steps naked program « LASTx + », close to a simple RPL code leaving the Fibonacci sequence reversed in the stack initiate by 1 DUP and repeating « OVER OVER + » over and over... 

10142021, 02:13 PM
(This post was last modified: 10142021 04:10 PM by Albert Chan.)
Post: #22




RE: HP 25 Fibonacci sequence in one program step
(10142021 10:03 AM)C.Ret Wrote: We can use this to get fib(n+m) = fib(m)*fib(n+1) + fib(m1)*fib(n) If n=m, we have fib(2n) = fib(n) * (fib(n+1) + fib(n1)) Using this, we can can 1/sqrt(5) another way φ^n ≈ fib(2n) / fib(n) = fib(n+1) + fib(n1) ≈ fib(n) * (φ+1/φ) = fib(n) * √5 fib(n) = round(φ^n / √5) 

10142021, 07:04 PM
(This post was last modified: 10172021 03:41 PM by rprosperi.)
Post: #23




RE: HP 25 Fibonacci sequence in one program step
(10142021 02:13 PM)Albert Chan Wrote:(10142021 10:03 AM)C.Ret Wrote: Looks like more than 1 program step to me.... Also, where are those functions on an HP25? I've looked at mine again today, and just can't see them anywhere... Bob Prosperi 

10162021, 02:55 PM
(This post was last modified: 10162021 03:00 PM by Gerson W. Barbosa.)
Post: #24




RE: HP 25 Fibonacci sequence in one program step
(10132021 08:34 PM)rprosperi Wrote: Many other models support recall arithmetic (45, 27, 15C, 32S, 32SII, others?) but only the 42S includes recall arithmetic AND stack register access. Since we’re at it, I decided to write an HP42S program to display the Fibonacci sequence trying to use the least number of steps (Not sure whether I’ve succeeded or not – another one I tried has exactly the same number of steps and bytes). Interestingly an equivalent HP15C program, which lacks recall stack arithmetic but does have recall arithmetic, is possible using the same number of steps (8). Code:
XEQ “Fib” → 0 R/S → 1 R/S → 1 R/S → 2 R/S → 3 R/S → 5 R/S → 8 … 

10172021, 02:17 PM
(This post was last modified: 10172021 02:45 PM by Gerson W. Barbosa.)
Post: #25




RE: HP 25 Fibonacci sequence in one program step
(10162021 02:55 PM)Gerson W. Barbosa Wrote: (Not sure whether I’ve succeeded or not – another one I tried has exactly the same number of steps and bytes) Surely I hadn’t. It is possible to do it in 6 steps and 17 steps. Thanks Mike (Stgt) for his comment “Many think a program must start with a global label, but no, it needs not” and examples which easily lead to Code:
Edited for a minor grammar issue 

« Next Oldest  Next Newest »

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