HP Forums

Full Version: (33s) OEIS A7953: Sum of Digits of N
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Reference URL's