Post Reply 
(33s) OEIS A7612: A(N-1)+Digital Root of A(N-1)
08-17-2022, 03:21 AM
Post: #1
(33s) OEIS A7612: A(N-1)+Digital Root of A(N-1)
Takes a natural number from the stack & returns A7612(N).

https://oeis.org/A007612

Digital root:

https://www.hpmuseum.org/forum/thread-18672.html

A(N-1)+Digital root of A(N-1), starting from 1.
Preserves stack.

Code:
1.    LBL C
2.    STO N
3.    CLx
4.    RMDR(N:6)
5.    STO P
6.    CLx
7.    2^(P-1)
8.    STO P
9.    CLx
10.    27*IDIV(N:6)+P-FP(P)*9
11.    RTN

C: LN = 71
Find all posts by this user
Quote this message in a reply
08-17-2022, 06:33 PM
Post: #2
RE: (33s) OEIS A7612: A(N-1)+Digital Root of A(N-1)
Code:
10.    27*IDIV(N:6)+P-FP(P)*9

Nice formula!

You can combine steps 4 and 7, and save a few steps:

Code:
1.    LBL C
2.    STO N
3.    CLx
4.    2^(RMDR(N:6)-1)
5.    STO P
6.    CLx
7.    27*IDIV(N:6)+P-FP(P)*9
8.    RTN
Find all posts by this user
Quote this message in a reply
08-18-2022, 04:15 AM
Post: #3
RE: (33s) OEIS A7612: A(N-1)+Digital Root of A(N-1)
Thank you, Didier.

Here are size & CKSUM for the shortened programme.

Code:
C: LN = 61    CK = 1373

I haven't previously noted the CK due to a confusion with the 35s, where the check sums are meaningless - However, the 33s does not share that fault & the datum is worth noting.
Find all posts by this user
Quote this message in a reply
Post Reply 




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