HP50g small tips and trick
|
02-20-2017, 09:21 PM
Post: #16
|
|||
|
|||
RE: HP50g small tips and trick
I needed an algorithm to get the digits of an integer in any base. This was as fast as I could do easily.
Input: N, P (the number and base respectively) << -> N P << {} WHILE N REPEAT N P MOD + N P / FLOOR 'N STO END >> I did try using STO+ to generate the list and some playing around with LASTX but none were faster. I can be a little faster by just leaving the remainders on the stack then using DEPTH and ->LIST to pick up the result, but that requires (I think) an empty stack at the beginning which makes it less easy to use the routine in other programs. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: