(33s) OEIS A68637: Maximum of Input & Reversal
|
08-11-2022, 04:06 AM
Post: #1
|
|||
|
|||
(33s) OEIS A68637: Maximum of Input & Reversal
Due to huge lack of labels on 33s I clumsily use flags - as there is only one flag test (FS?) I use two flags.
Can anyone suggest a more economical approach? Takes a real integer from the stack & returns A68637(N), to stack. https://oeis.org/A068637 Returns maximum of N & reversal. Preserves stack. Code: 1. LBL B Reverso. Reverses the order of digits in stack level X. eg 1234 becomes 4321. Preserves stack. Code: 1. LBL R R: LN = 12 S: LN = 61 |
|||
08-11-2022, 08:42 AM
Post: #2
|
|||
|
|||
RE: (33s) OEIS A68637: Maximum of Input & Reversal | |||
08-11-2022, 01:04 PM
Post: #3
|
|||
|
|||
RE: (33s) OEIS A68637: Maximum of Input & Reversal
Thank you, Didier, a lesson in economy!
|
|||
08-11-2022, 01:55 PM
Post: #4
|
|||
|
|||
RE: (33s) OEIS A68637: Maximum of Input & Reversal
I'm glad to see you posting OEIS sequence programs again. They are always interesting and fun. This one particularly reminds me of your thread here which resulted in the ListExt function REV for the 49g/50g. That reduces the program to the trivial DUP REV MAX in RPL.
|
|||
08-11-2022, 02:56 PM
(This post was last modified: 08-11-2022 02:59 PM by Didier Lachieze.)
Post: #5
|
|||
|
|||
RE: (33s) OEIS A68637: Maximum of Input & Reversal
(08-11-2022 01:04 PM)Gerald H Wrote: Thank you, Didier, a lesson in economy! You already had half of the solution Here the goal was to get the max of X and A in the minimum steps, you already had RCL- A and x>0?, after that the flags management was adding a lot of complexity. I removed all these flags instructions, looked at what was remaining and realized that we had R-A in X and by adding it to the register A after the x>0? we would get R in this register if R was bigger than A or A if it was lower, then x<> A to not disturb the stack and we have the max of X and A in 4 steps. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)