RPN83P: RPN calculator for TI-83+ TI-84+ inspired by HP-42S
|
11-21-2023, 05:24 PM
(This post was last modified: 11-21-2023 05:31 PM by bxparks.)
Post: #7
|
|||
|
|||
RE: RPN83P: RPN calculator for TI-83+ TI-84+ inspired by HP-42S
(11-21-2023 09:26 AM)Gerald H Wrote: Very nice work, bxparks, bravo! Thanks! Early versions of PRIM just returned a boolean (0 or 1) to indicate prime, but it was more useful to return the smallest prime factor. I have updated the README.md and USER_GUIDE.md to make that more clear. I don't know if you saw it, but I explained how to get all the prime factors of a number N (< 2^32) iteratively (https://github.com/bxparks/rpn83p/blob/d...me-factors), because PRIM lifts the original N to Y, then pushes the prime factor into X. So you can just hit / to get the next number to factor, and hit PRIM again. The largest prime number <= 2^16 is 65521, so the longest execution time of PRIM is the factorization of 65521*65221=4 293 001 441. That takes 33 seconds on a TI-84+SE. I spent far too much time optimizing the PRIM function. :-) I just added notes about how PRIM works in the DEVELOPER.md notes here: https://github.com/bxparks/rpn83p/blob/d...VELOPER.md . I am copying the info below to save a click:
I think there are additional micro-optimizations left on the table that could make the PRIM function maybe 1.5X to 2X faster, without resorting to a completely different algorithm. But I suspect that the resulting code would be difficult to understand and maintain. So I decided to stop here. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 26 Guest(s)