(33s) OEIS A2113: Palindromes in Natural Order
|
08-05-2022, 12:54 PM
(This post was last modified: 08-06-2022 12:12 PM by Gerald H.)
Post: #1
|
|||
|
|||
(33s) OEIS A2113: Palindromes in Natural Order
Edit: 2022-08-06 Simplification of lines 4 & 5 of programme P.
Some years ago I wrote a programme for 49G to produce the same numbers - not so difficult if you have possibility of treating numbers as text. https://www.hpmuseum.org/forum/thread-9988.html The poor 33s only has numerical capabilities so I have risen to the challenge. The programme P uses three helper programmes T, H & R shown below P. All of the four programmes preserve the stack. (Let's see you do that on 41C or 42S!) Suggestions for improvements welcome. Takes a natural number N from the stack & returns A2113(N) to stack, Nth palindrome in natural order. Does not disturb stack. Code: 1. LBL P P: LN = 41 V: LN =28 Q: LN = 132 X: LN =24 U: LN = 35 Y: LN = 18 Head. Erases all but first digit of stack level X. Does not disturb stack. Code: 1. LBL H Tail. Erases first digit of stack level X. Does not disturb stack. Code: 1. LBL T Reverso. Reverses the order of digits in stack level X. eg 1234 becomes 4321. Does not disturb stack. Code: 1. LBL R |
|||
09-02-2022, 02:50 AM
Post: #2
|
|||
|
|||
RE: (33s) OEIS A2113: Palindromes in Natural Order
Following this thread
https://www.hpmuseum.org/forum/thread-18742.html a better version of HEAD: Code: 1. LBL X |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)