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 A4186: Digits in Descending Order
09-22-2022, 03:33 AM
Post: #1
(33s) OEIS A4186: Digits in Descending Order
Takes a natural number from the stack & returns A4186(N) to stack.
Digits of index decreasing.

eg Input

10477

returns

77410.

I use [i] to represent the built in sign for use of i in indirect addressing to avoid confusion in say

IP(LOG((i)))

or

5*(i).

Suggestions for improvements most welcome.

https://oeis.org/A004186

Preserves stack.

Code:
1.    LBL D
2.    CLVARS
3.    STO K
1.    LBL F
2.    x=0?
3.    GTO G
4.    CLx
5.    RMDR(K:10)+1
6.    STO i
7.    SGN
8.    STO+ [i]
9.    CLx
10.    IDIV(K:10)
11.    STO K
12.    GTO F
1.    LBL G
2.    CLx
3.    10
4.    STO i
5.    CLx
6.    STO T
1.    LBL H
2.    CLx
3.    RCL [i]
4.    x=0?
5.    GTO J
1.    LBL I
2.    CLx
3.    10* T+i-1
4.    STO T
5.    DSE [i]
6.    GTO I
1.    LBL J
2.    DSE i
3.    GTO H
4.    CLx
5.    RCL T
6.    RTN

D: LN = 9        H: LN = 15
F: LN = 58        I: LN = 26
G: LN = 30        J: LN = 18
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(33s) OEIS A4186: Digits in Descending Order - Gerald H - 09-22-2022 03:33 AM



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