Old HPMuseum HP-30b primality test on the 41x

Discussion about the new DM41X calculator
jonmoore
Posts: 106
Joined: Mon Apr 13, 2020 4:18 pm

Old HPMuseum HP-30b primality test on the 41x

Post by jonmoore »

Reading an old HP-30b thread at HPMuseum this morning, I thought it would be interesting to benchmark the speed of the same 9,999,999,967 primality test on the 41x. As a comparative benchmark, the fastest routine on the 30b was 40 seconds.

The 41x came in at 14 seconds in Fast mode (with USB power) and 34 seconds, Fast Mode (no USB). The primality test routine was one originally authored by Jason DeLooze but subsequently converted to MCode by Ángel Martin for inclusion in SandMath.

Pretty impressive considering the the 41x is running as an emulation and the 30b is already recognised to by pretty zippy by most in the HP calc community. I didn't test in Slow mode, but as Bob said in his HHC announcement last year - if you're running long calculations, there are far better options out there than handheld calculators!

I'm sure that the WP43s will be able to better this score considerably (and the same can probably be said for the DM42) but the 41x seems to be reasonably performant, especially for an emulated solution; particularly when it's running well designed MCode routines such as those found in SandMath.
User avatar
Walter
Posts: 1743
Joined: Tue May 02, 2017 11:13 am
Location: Close to FRA, Germany

Re: Old HPMuseum HP-30b primality test on the 41x

Post by Walter »

Just FYI, the WP43S' function PRIME? returns "true" for an input of 9 999 999 967 instantaneously (i.e. <<1s) on the target hardware.
Still far less than 1s for an input of 999 999 999 999 999 999 017.
For 999 999 999 999 999 999 999 999 999 999 999 999 943, it needs ~ 1s. 8-)
DM42 SN: 00041 β
WP 43S running on this device

HP-35, HP-45, ..., HP-35S, WP 34S, WP 31S, DM16L
jonmoore
Posts: 106
Joined: Mon Apr 13, 2020 4:18 pm

Re: Old HPMuseum HP-30b primality test on the 41x

Post by jonmoore »

Walter wrote:
Mon May 04, 2020 3:56 pm
Just FYI, the WP43S' function PRIME? returns "true" for an input of 9 999 999 967 instantaneously (i.e. <<1s) on the target hardware.
Still far less than 1s for an input of 999 999 999 999 999 999 017.
For 999 999 999 999 999 999 999 999 999 999 999 999 943, it needs ~ 1s. 8-)
And that's why I'm keen for one of those beta units when they're available! :)
jonmoore
Posts: 106
Joined: Mon Apr 13, 2020 4:18 pm

Re: Old HPMuseum HP-30b primality test on the 41x

Post by jonmoore »

On a more serious note, the reason I purchased the 41x is the range of excellent Modules that have been produced in the 41CL era. The programs I write with those Modules don't require high precision or super performance (although my unfounded fear was that an emulated 41 solution on DM hardware would be sluggish).

My interest in the 43s is in particular driven by its precision and speed (and hopefully, the elegance of its 42+ programming language). The 42 stays in my armoury because of it's relative simplicity.

There's a definitive utility for each DM, and combined they'll take up less room in my backpack and weigh less than my 50g!
User avatar
pauli
Posts: 122
Joined: Tue May 02, 2017 10:11 am
Location: Australia

Re: Old HPMuseum HP-30b primality test on the 41x

Post by pauli »

The 43S is using a completely different algorithm for its primality test. It's using Miller-Rabin. It is set up so that gives precise results up to a reasonably large number (3317044064679887385961981), beyond that it is only reporting probable primes.

Pauli
jonmoore
Posts: 106
Joined: Mon Apr 13, 2020 4:18 pm

Re: Old HPMuseum HP-30b primality test on the 41x

Post by jonmoore »

pauli wrote:
Tue May 05, 2020 1:30 pm
The 43S is using a completely different algorithm for its primality test. It's using Miller-Rabin. It is set up so that gives precise results up to a reasonably large number (3317044064679887385961981), beyond that it is only reporting probable primes.

Pauli
Thanks for the extra info Paul. I'm pretty sure the level of precision you're offering in the 43s is going to more than satisfy the needs of more than 99% of pocket scientific-calculator users.

The thing that I find most interesting in the 43s project is that much as you and Walter have worked to a design strategy based on decades of community involvement and feedback, the project still benefits from a definitive design DNA based on your own goals. By comparison, the 41 universe is a truly 'crowd-sourced' affair with all the positives and negatives of such projects. As an end user I'm very grateful that I will have access to both (as well as the DM42).

For me there's no such thing as an 'ultimate' pocket calculator 'to rule them all'; so having access to multiple DM devices that come in the same form factor is nothing but a good thing. Variety being the spice of life and all that jazz...
User avatar
Mark Hardman
Posts: 116
Joined: Wed May 03, 2017 3:26 am
Location: Houston, TX

Re: Old HPMuseum HP-30b primality test on the 41x

Post by Mark Hardman »

pauli wrote:
Tue May 05, 2020 1:30 pm
The 43S is using a completely different algorithm for its primality test. It's using Miller-Rabin. It is set up so that gives precise results up to a reasonably large number (3317044064679887385961981), beyond that it is only reporting probable primes.

Pauli
Does "probable" only include false positives or is there a possibility of false negatives as well? Can the 43s handle Belphegor's "satanic" prime?

1000000000000066600000000000001

* 1 followed by 13 zeros, the number of the beast followed by another 13 zeros and a final 1
DM42: β00043, β00065, 00357 / DM41X: β00054, 00445
DM10L: 017/100, DM11L: 00121, DM12L: 02005, DM15L: 00523, DM16L: 00008, DM41L: 00111
User avatar
Walter
Posts: 1743
Joined: Tue May 02, 2017 11:13 am
Location: Close to FRA, Germany

Re: Old HPMuseum HP-30b primality test on the 41x

Post by Walter »

Mark Hardman wrote:
Tue May 05, 2020 10:30 pm
pauli wrote:
Tue May 05, 2020 1:30 pm
The 43S is using a completely different algorithm for its primality test. It's using Miller-Rabin. It is set up so that gives precise results up to a reasonably large number (3317044064679887385961981), beyond that it is only reporting probable primes.
Does "probable" only include false positives or is there a possibility of false negatives as well? Can the 43s handle Belphegor's "satanic" prime?

1000000000000066600000000000001

* 1 followed by 13 zeros, the number of the beast followed by another 13 zeros and a final 1
1) This question goes to Pauli.
2) Yes, it can - the target hardware responds with "true" in <1s. BTW, the next prime ends with ...000 229.
DM42 SN: 00041 β
WP 43S running on this device

HP-35, HP-45, ..., HP-35S, WP 34S, WP 31S, DM16L
jonmoore
Posts: 106
Joined: Mon Apr 13, 2020 4:18 pm

Re: Old HPMuseum HP-30b primality test on the 41x

Post by jonmoore »

:)

At 31 digits it would appear to be into the realm of the probable. But to be frank I'd be even more spooked if the 43s answers in the affirmative as to the identity of Belphegor's prime.
User avatar
Walter
Posts: 1743
Joined: Tue May 02, 2017 11:13 am
Location: Close to FRA, Germany

Re: Old HPMuseum HP-30b primality test on the 41x

Post by Walter »

Please see here:
.
PRIME.png
PRIME.png (20.72 KiB) Viewed 753 times
DM42 SN: 00041 β
WP 43S running on this device

HP-35, HP-45, ..., HP-35S, WP 34S, WP 31S, DM16L
Post Reply