Post Reply 
Most advantageous program written for 41/42?
03-08-2021, 03:08 AM (This post was last modified: 03-08-2021 01:03 PM by DM48.)
Post: #1
Most advantageous program written for 41/42?
What do you believe to be the most advantageous program written for the HP41/42?

I was reading through the 41 software library forum and the width, breath, and depth of programs amazed me. I was wondering what everyone here thought would be one of the most advantageous programs written for the 41/42.

There are no wrong answers, just no answers.

HP48GX, HP42s and DM42.
Find all posts by this user
Quote this message in a reply
03-10-2021, 06:14 AM
Post: #2
RE: Most advantageous program written for 41/42?
(03-08-2021 03:08 AM)DM48 Wrote:  What do you believe to be the most advantageous program written for the HP41/42?

I was reading through the 41 software library forum and the width, breath, and depth of programs amazed me. I was wondering what everyone here thought would be one of the most advantageous programs written for the 41/42.

There are no wrong answers, just no answers.

For me it’s a primarily test. Very basic feature imho missing from (all?) the RPN machines.
Find all posts by this user
Quote this message in a reply
03-10-2021, 02:48 PM
Post: #3
RE: Most advantageous program written for 41/42?
I assume you mean primality testing? I would guess that it was not a built-in feature because it would be uselessly slow for numbers over 3 digits in most cases. With today's fast hardware and emulators of course this is no longer the case.
Find all posts by this user
Quote this message in a reply
03-10-2021, 10:57 PM (This post was last modified: 03-10-2021 10:58 PM by Allen.)
Post: #4
RE: Most advantageous program written for 41/42?
I would tend to agree regarding the primality testing.

Many primality testing algorithms are quite fast if you have a modular exponentation function available on the calculator.

The Rabin-miller test for example can guarantee primailty for n < 1,122,004,669,633, by only testing 4 situations where a = 2, 13, 23, and 1662803. ( other bounds in the wikipedia article)

I heavily use a pollard-rho factorization algorithm on my 42s (excellent free42 emulator) which can factor any number my emulated 42s can handle in less than a second.

17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b

Find all posts by this user
Quote this message in a reply
03-10-2021, 11:44 PM
Post: #5
RE: Most advantageous program written for 41/42?
(03-10-2021 10:57 PM)Allen Wrote:  I would tend to agree regarding the primality testing.

Many primality testing algorithms are quite fast if you have a modular exponentation function available on the calculator.

The Rabin-miller test for example can guarantee primailty for n < 1,122,004,669,633, by only testing 4 situations where a = 2, 13, 23, and 1662803. ( other bounds in the wikipedia article)

I heavily use a pollard-rho factorization algorithm on my 42s (excellent free42 emulator) which can factor any number my emulated 42s can handle in less than a second.

Do you have a link to the program or can you paste the code here? I had no idea we would have such agreement so early in the beginning!

HP48GX, HP42s and DM42.
Find all posts by this user
Quote this message in a reply
03-11-2021, 01:47 AM
Post: #6
RE: Most advantageous program written for 41/42?
(03-10-2021 11:44 PM)DM48 Wrote:  
(03-10-2021 10:57 PM)Allen Wrote:  I would tend to agree regarding the primality testing.

Many primality testing algorithms are quite fast if you have a modular exponentation function available on the calculator.

The Rabin-miller test for example can guarantee primailty for n < 1,122,004,669,633, by only testing 4 situations where a = 2, 13, 23, and 1662803. ( other bounds in the wikipedia article)

I heavily use a pollard-rho factorization algorithm on my 42s (excellent free42 emulator) which can factor any number my emulated 42s can handle in less than a second.

Do you have a link to the program or can you paste the code here? I had no idea we would have such agreement so early in the beginning!

Here's a Miller-Rabin prime tester that I occasionally use on my 42S and/or DM42:

https://archived.hpcalc.org/hp42s/programs/prm/prm.html
Visit this user's website Find all posts by this user
Quote this message in a reply
03-11-2021, 06:22 AM
Post: #7
RE: Most advantageous program written for 41/42?
Shanks' square form factorization generally faster than Pollard rho on 42S.

For info on SQFOF see

https://en.wikipedia.org/wiki/Shanks%27s...torization

The two programmes below realize SQFOF on 42S.

Enter number N to factorize on stack level X & actuate SQFO, programme returns factor to stack level X or declares “Elliptic Period” if the continued fraction is too short to discover a factor.

If no factor found you can try multiplying N by a small factor, eg 3 or 5 or 7...... & run SQFO on the product, possibly resulting in a proper factor of N being returned.


Code:
0.    { 217-Byte Prgm }
1.    LBL 04
2.    “Elliptic Period”
3.    AVIEW
4.    TONE 0
5.    STOP
6.    LBL 01
7.    RCL 08
8.    RCL+ ST X
9.    LBL “SQFO”
10.    STO 08
11.    ENTER
12.    SQRT
13.    IP
14.    STO 04
15.    STO 02
16.    X^2
17.    –
18.    X=0?
19.    GTO 00
20.    STO 03
21.    1
22.    X=Y?
23.    GTO 01
24.    40
25.    X<>Y
26.    STO 07
27.    NEWMAT
28.    STO “MATA”
29.    INDEX “MATA”
30.    CF 00
31.    8
32.    RCL* 02
33.    SQRT
34.    IP
35.    STO 05
36.    LBL 03
37.    RCL 05
38.    RCL 03
39.    RCL ST X
40.    –2
41.    MOD
42.    RCL- ST L
43.    / 
44.    X>Y?
45.    GTO 06
46.    RCL 07
47.    1
48.    STOIJ
49.    RCL ST Z
50.    STOEL
51.    ISG 07
52.    LBL 06
53.    RCL 02
54.    ENTER
55.    RCL+ 04
56.    RCL 03
57.    MOD
58.    –
59.    STO 04
60.    X^2
61.    +/-
62.    RCL+ 08
63.    RCL/ 03
64.    STO 03
65.    ENTER
66.    SQRT
67.    FS?C 00
68.    GTO 03
69.    SF 00
70.    FP
71.    X≠0?
72.    GTO 03
73.    1
74.    LASTX
75.    X=Y?
76.    GTO 04
77.    [FIND]
78.    GTO 03
79.    STO 06
80.    RCL 08
81.    XEQ “GCF”
82.    1
83.    X=Y?
84.    GTO 05
85.    R↓
86.    TONE 9
87.    RTN
88.    LBL 05
89.    RCL 06
90.    RCL 02
91.    RCL- 04
92.    RCL ST X
93.    RCL 06
94.    MOD
95.    –
96.    RCL+ 04
97.    LBL 02
98.    RCL 08
99.    RCL ST Y
100.    X^2
101.    –
102.    RCL/ 06
103.    STO 06
104.    RCL 02
105.    RCL+ ST Z
106.    X<>Y
107.    MOD
108.    +/-
109.    RCL+ 02
110.    X≠Y?
111.    GTO 02
112.    RCL 06
113.    RCL ST X
114.    –2
115.    MOD
116.    RCL- ST L
117.    /
118.    TONE 5
119.    RTN
120.    LBL 00
121.    RCL 04
122.    END

0.    { 16-Byte Prgm }
1.    LBL “GCF”
2.    LBL 00
3.    MOD
4.    LASTX
5.    X<>Y
6.    X≠0?
7.    GTO 00
8.    R↓
9.    ABS
10.    END
Find all posts by this user
Quote this message in a reply
03-11-2021, 06:35 AM (This post was last modified: 03-11-2021 06:37 AM by Gamo.)
Post: #8
RE: Most advantageous program written for 41/42?
Not the most advance but not include in the HP pac is

This program called Profit on Pricing or Business Percentage.

So I make one especially for 41/42

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

Gamo
Find all posts by this user
Quote this message in a reply
03-11-2021, 04:10 PM (This post was last modified: 03-11-2021 04:12 PM by Ren.)
Post: #9
RE: Most advantageous program written for 41/42?
So now this math deficient needs to look up what primality testing is about.
B^)

From Wikipedia, the free encyclopedia

A primality test is an algorithm for determining whether an input number is prime. Among other fields of mathematics, it is used for cryptography. Unlike integer factorization, primality tests do not generally give prime factors, only stating whether the input number is prime or not. Factorization is thought to be a computationally difficult problem, whereas primality testing is comparatively easy (its running time is polynomial in the size of the input). Some primality tests prove that a number is prime, while others like Miller–Rabin prove that a number is composite. Therefore, the latter might more accurately be called compositeness tests instead of primality tests.

10B, 10BII, 10C, 11C, 12C, 14B, 15C, 16C, 17B, 18C, 19BII, 20b, 22, 25, 29C, 35, 38G, 39G, 39gs, 41CV, 48G, 97
Find all posts by this user
Quote this message in a reply
03-12-2021, 08:31 AM (This post was last modified: 03-12-2021 08:41 AM by EdS2.)
Post: #10
RE: Most advantageous program written for 41/42?
(03-11-2021 06:22 AM)Gerald H Wrote:  Shanks' square form factorization generally faster than Pollard rho on 42S.

For info on SQFOF see

https://en.wikipedia.org/wiki/Shanks%27s...torization

See also Shanks' own notes on SQUFOF, as transcribed here, and particularly this bit about the HP-65:
Quote:Concerning Brillhart’s second question, I felt that the answer would be, “no”—N₀ does not lead to absolute failure, but to prove this I had only a hand-held HP-65 with its very small memory (100 steps in the program). Obviously, one cannot put the huge BRIMOR on such a machine. But one can put on the simple algorithm...
... factor the 19-digit N₀ as
(22) N₀ = 139001459 · 8294312261
even though the HP-65 only computes with 10-digit numbers.


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Post Reply 




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