Prime Factors
|
05-18-2015, 06:10 PM
(This post was last modified: 05-19-2015 01:13 PM by Dave Britten.)
Post: #1
|
|||
|
|||
Prime Factors
In an attempt to rival Doom for the largest number of systems to which it's been ported, here's the usual HP 67 "mod 30" prime factors program for the 41C/CV/CX.
Enter a positive integer, and XEQ FCTR. Press R/S to view each factor. Zero will be displayed when there are no more factors. Note this is a pretty straight port, and hasn't been fancied up with any 41-specific capabilities (yet). EDIT: Here's a slightly improved version with a couple optimizations, and multiplicity display for factors (e.g. 3^2, 7^3, etc). Code: 01 LBL FCTR |
|||
05-18-2015, 08:31 PM
Post: #2
|
|||
|
|||
RE: Prime Factors
(05-18-2015 06:10 PM)Dave Britten Wrote: Note this is a pretty straight port, and hasn't been fancied up with any 41-specific capabilities (yet). You might have a look at a program for the HP-42s which uses the same idea. Cheers Thomas |
|||
05-19-2015, 02:58 AM
Post: #3
|
|||
|
|||
RE: Prime Factors
(05-18-2015 08:31 PM)Thomas Klemm Wrote:(05-18-2015 06:10 PM)Dave Britten Wrote: Note this is a pretty straight port, and hasn't been fancied up with any 41-specific capabilities (yet). Thanks Thomas. Clever use of t-copy there. I see a couple things that could be issues for a 41 port: the use of recall arithmetic, as mentioned in that thread, AIP, which requires the appropriate module or alternative code, and the alpha register being limited to 24 characters. I don't recall the 42S alpha limit, but I think I remember it being larger. I changed my version a bit to display multiplicity of factors as they're found (3^2, 5^3, etc.) and also replaced the / FRC bits with MOD, which appears to be about 20% faster. I'll probably post the updated code tomorrow. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)