Post Reply 
(HP48) Beginner questions about RPL
10-23-2024, 05:28 PM
Post: #2
RE: (HP48) Beginner questions about RPL
This appears to be a variation of the following PRL program created by Joe Horn.

\<< 0 SWAP @ Put an empty loop counter in level 2.
WHILE DUP 1 > @ Exit as soon as it gets to 1.
REPEAT
IF DUP 2 MOD @ is it odd?
THEN 3 * 1 + @ yes? then multiply by 3 and add 1;
ELSE 2 / @ no? then divide by 2.
END
SWAP 1 + SWAP @ Increment the loop counter.
END DROP @ Lose the "1" and stop.
\>>

See the following Hailstone Path download at hpcalc.org. Joe has a very nice write-up that discusses this subject.
https://www.hpcalc.org/details/6808
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (HP48) Beginner questions about RPL - Steve Simpkin - 10-23-2024 05:28 PM



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