Post Reply 
(33s) OEIS A000966: Prohibited Zero Endings of Factorials
09-30-2017, 10:02 AM (This post was last modified: 07-23-2022 10:12 AM by Gerald H.)
Post: #1
(33s) OEIS A000966: Prohibited Zero Endings of Factorials
[Edit 2022-07-23: Old line 5 of LBL A deleted as redundant.]

The following five programmes together produce 4 sequences from the OEIS on the HP 33s.

The 33s is a very fast calculator. The table below shows times on various HP calculators to calculate

A966(88,888,888,888)

using the programmes here presented & variously optimised for the respective calculator.

Model Time in sec
42S 45
40G 40
38G 30
35s 18
39gs 14
50g User 8.8
33s 8
49G Sys 1.2
50g Sys 0.6

The first programme takes a real integer N from the stack & returns A966(N) to stack.

https://oeis.org/A000966

Code:
1.    LBL A
2.    STO A
3.    XEQ B
4.    ENTER
5.    STO B
6.    XEQ D
7.    STO D
8.    RCL B
9.    ENTER
10.    ENTER
11.    6
12.    *
13.    -1
14.    STO Z
15.    +
16.    STO E
17.    x<>y
1.    LBL Q
2.    XEQ V
3.    STO+ E
4.    x≠0?
5.    GTO Q
6.    RCL D
7.    x≠0?
8.    GTO R
9.    RCL E
10.    RTN
1.    LBL R
2.    1
3.    STO+ Z
4.    STO- A
5.    RCL A
6.    XEQ B
7.    RCL B
8.    x=y?
9.    GTO R
10.    RCL E
11.    RCL- D
12.    RCL+ Z
13.    RTN

Takes a real integer N from the stack & returns A228297(N) to stack.

https://oeis.org/A228297

Code:
1.    LBL B
2.    ENTER
3.    ENTER
4.    XEQ V
5.    -
1.    LBL O
2.    ENTER
3.    ENTER
4.    XEQ C
5.    +
6.    x<>y
7.    R↓
8.    x<>y
9.    -
10.    x≥0?
11.    GTO P
12.    SGN
13.    R↑
14.    x<>y
15.    -
16.    GTO O
17.    LBL P
18.    R↑
19.    RTN

Takes a real integer N from the stack & returns A27868(N) to stack, leaving Y, Z & T stack levels unaltered.

https://oeis.org/A027868

Code:
1.    LBL C
2.    x<>L
3.    CLx
4.    x<>L
1.    LBL N
2.    XEQ V
3.    STO+ L
4.    x≠0?
5.    GTO N
6.    x<>L
7.    RTN

Takes a real integer N from the stack & returns A112765(N) to stack.

https://oeis.org/A112765

Code:
1.    LBL D
2.    -1
1.    LBL L
2.    1
3.    +
4.    x<>y
5.    XEQ V
6.    x<>y
7.    RCL R
8.    x≠0?
9.    GTO M
10.    R↓
11.    GTO L
1.    LBL M
2.    R↓
3.    RTN

Takes a real integer from the stack & stores remainder on division by 5 in R & quotient in Q & returns Q to stack, leaving Y, Z & T stack levels unaltered.

Code:
1.    LBL V
2.    R↑
3.    STO J
4.    R↓
5.    STO R
6.    5
7.    RMDR
8.    x<>R
9.    5
10.    INT/
11.    R↑
12.    X<>J
13.    R↓
14.    STO Q
15.    RTN
Find all posts by this user
Quote this message in a reply
09-30-2017, 10:16 AM
Post: #2
RE: (33s) OEIS A000966: Prohibited Zero Endings of Factorials
it is nice that you got hooked on oeis sequences! They provide nice inputs.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
07-23-2022, 10:14 AM (This post was last modified: 07-23-2022 10:15 AM by Gerald H.)
Post: #3
RE: (33s) OEIS A000966: Prohibited Zero Endings of Factorials
In post #1 old line 5 of LBL A deleted as redundant.
Find all posts by this user
Quote this message in a reply
04-17-2023, 05:01 AM (This post was last modified: 04-18-2023 05:09 PM by Gerald H.)
Post: #4
RE: (33s) OEIS A000966: Prohibited Zero Endings of Factorials
[Edit: When I say "improved" I mean more elegant & smaller - unfortunately this programme takes 2* the time of the original programme.]

An improved version of programme "V":

Takes a natural number from the stack & stores remainder on division by 5 in R & quotient in Q & returns Q to stack.
Preserves stack.

Code:
1.    LBL V
2.    STO R
3.    CLx
4.    RMDR(R:5)
5.    x<>R
6.    RCL- R
7.    STO Q
8.    CLx
9.    Q/5
10.    STO Q
11.    RTN

V: LN = 45
Find all posts by this user
Quote this message in a reply
04-18-2023, 05:13 AM
Post: #5
RE: (33s) OEIS A000966: Prohibited Zero Endings of Factorials
(09-30-2017 10:02 AM)Gerald H Wrote:  ...
The 33s is a very fast calculator. The table below shows times on various HP calculators to calculate
...

That is really amazing considering it is using an enhanced 6502 CPU core (Sunplus SPLB31A).
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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