Post Reply 
(33s): OEIS A8905 & A34886: 1st Digit of N! & Number of Digits in N!
07-23-2022, 02:07 PM (This post was last modified: 07-24-2022 09:40 AM by Gerald H.)
Post: #1
(33s): OEIS A8905 & A34886: 1st Digit of N! & Number of Digits in N!
[Edit 2022-07-24: Programmes W & X corrected.]

The 33s has both RPN & Algebraic capabilities, exemplified by the two programmes below.

The RPN version uses up two of the scarce LBLs & occupies 174 Bytes of the ample memory.

The Algebraic version requires 144 Bytes of memory.

The RPN version is faster.

Most of my students find the Algebraic version much clearer & easier to programme.


Takes a real integer N from the stack & returns A8905(N) & A34886(N) to stack.
First digit of n!; Number of digits in n!.

https://oeis.org/A008905

https://oeis.org/A034886

Code:
1.    LBL S
2.    3
3.    x<y?
4.    GTO T
5.    R↓
6.    x!
7.    1
8.    RTN
1.    LBL T
2.    R↓
3.    ENTER
4.    LOG
5.    ENTER
6.    ENTER
7.    1
8.    e^x
9.    LOG
10.    –
11.    R↑
12.    *
13.    x<>y
14.    π
15.    ENTER
16.    +
17.    LOG
18.    +
19.    2
20.    /
21.    +
22.    ENTER
23.    FP
24.    10^x
25.    IP
26.    x<>y
27.    IP
28.    1
29.    +
30.    RTN

Alternative to programme S.

Code:
1.    LBL W
2.    3
3.    x<y?
4.    GTO X
5.    R↓
6.    x!
7.    1
8.    RTN
1.    LBL X
2.    R↓
3.    STO N
4.    CLx
5.    1+(LOG(2)+LOG(π)+LOG(N))/2+N*(LOG(N)-LOG(EXP(1)))
6.    STO N
7.    IP(ALOG(FP(N)))
8.    IP(N)
9.    RTN
Find all posts by this user
Quote this message in a reply
07-24-2022, 09:41 AM
Post: #2
RE: (33s): OEIS A8905 & A34886: 1st Digit of N! & Number of Digits in N!
Edit to post #1, programmes W & X corrected.
Find all posts by this user
Quote this message in a reply
Post Reply 




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