The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(33s) OEIS A56525: Odd Digitted Palindromes in Natural Order
08-15-2022, 11:46 AM
Post: #1
(33s) OEIS A56525: Odd Digitted Palindromes in Natural Order
Takes a natural number N from the stack & returns A56525(N) to stack.
Nth odd digitted palindrome in natural order.
Preserves stack

https://oeis.org/A056525

Input of negative of odd digitted palindrome returns index in A56525.
Preserves stack.

Code:
1.    LBL O
2.    x<0?
3.    GTO B
4.    STO A
5.    LOG
6.    IP
7.    10^x
8.    STO S
9.    CLx
10.    RCL A
11.    XEQ R
12.    STO B
13.    LOG
14.    IP
15.    10^x
16.    STO T
17.    RCL- S
18.    x=0?
19.    GTO J
20.    CLx
21.    T*10
1.    LBL J
2.    RCL+ B
3.    XEQ T
4.    STO B
5.    CLx
6.    A*S+B
7.    RTN
1.    LBL B
2.    ABS
3.    STO A
4.    CLx
5.    IDIV(A:ALOG(IP(LOG(A)/2)))
6.    RTN

O: LN = 67
J: LN = 26
B: LN = 44

Tail.
Erases first digit of stack level X.
Preserves stack.

Code:
1.    LBL T
2.    x=0?
3.    RTN
4.    STO N
5.    LOG
6.    IP
7.    10^x
8.    STO R
9.    CLx
10.    RMDR(N:R)
11.    RTN

T: LN = 42

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 A56525: Odd Digitted Palindromes in Natural Order - Gerald H - 08-15-2022 11:46 AM



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