Post Reply 
(33s) OEIS A7953: Sum of Digits of N
08-16-2022, 08:07 AM (This post was last modified: 08-25-2022 11:55 AM by Gerald H.)
Post: #1
(33s) OEIS A7953: Sum of Digits of N
Takes a natural number from the stack & returns A7953(N).
Sum of digits of index.
Preserves stack.

Code:
1.    LBL V
2.    STO N
3.    CLx
4.    STO C
5.    LBL U
6.    CLx
7.    RMDR(N:10)
8.    STO+ C
9.    CLx
10.    IDIV(N:10)
11.    STO N
12.    x≠0?
13.    GTO U
14.    RCL+ C
15.    RTN

V: LN = 12
U: LN = 53
Find all posts by this user
Quote this message in a reply
Post Reply 




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