Post Reply 
(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
2.    CF 1
3.    SF 2
4.    STO A
5.    XEQ R
6.    RCL- A
7.    x>0?
8.    SF 1
9.    FS? 1
10.    RCL+ A
11.    FS? 1
12.    CF 2
13.    FS? 2
14.    CLx
15.    FS? 2
16.    RCL+ A
17.    CF 1
18.    CF 2
19.    RTN

B: LN = 57

Reverso.
Reverses the order of digits in stack level X.
eg 1234 becomes 4321.
Preserves stack.

Code:
1.    LBL R
2.    STO N
3.    CLx
4.    STO R
1.    LBL S
2.    CLx
3.    10*R+RMDR(N:10)
4.    STO R
5.    CLx
6.    IDIV(N:10)
7.    STO N
8.    x≠0?
9.    GTO S
10.    CLx
11.    RCL R
12.    RTN

R: LN = 12
S: LN = 61
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(33s) OEIS A68637: Maximum of Input & Reversal - Gerald H - 08-11-2022 04:06 AM



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