HP Forums
(33s): OEIS A8905 & A34886: 1st Digit of N! & Number of Digits in N! - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (33s): OEIS A8905 & A34886: 1st Digit of N! & Number of Digits in N! (/thread-18585.html)



(33s): OEIS A8905 & A34886: 1st Digit of N! & Number of Digits in N! - Gerald H - 07-23-2022 02:07 PM

[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



RE: (33s): OEIS A8905 & A34886: 1st Digit of N! & Number of Digits in N! - Gerald H - 07-24-2022 09:41 AM

Edit to post #1, programmes W & X corrected.