Factor - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP-41C Software Library (/forum-11.html) +--- Thread: Factor (/thread-1117.html) Factor - Thomas Klemm - 04-18-2014 06:10 PM Find the factors of a number. Program for the HP-42s. Example: 167,699,497 XEQ "FACTOR" 7×3851×6221 RE: Factor - Les Bell - 04-20-2014 07:02 AM Is this for the 41, Thomas? I ran into trouble with step 38, which appears to do recall arithmetic with a stack register, something my 41CX seems unwilling to do. RE: Factor - Thomas Klemm - 04-20-2014 07:48 AM (04-20-2014 07:02 AM)Les Bell Wrote:  Is this for the 41, Thomas? Nah, the 42S. Quote:I ran into trouble with step 38, which appears to do recall arithmetic with a stack register, something my 41CX seems unwilling to do. Replace it with: Code: ```38 RCL Y 39 /``` But then you have to replace lines 05-07 at the beginning as well: Code: ```05 ENTER 06 XEQ 01 07 RDN 08 3``` HTH Thomas RE: Factor - Les Bell - 04-20-2014 08:44 AM (04-20-2014 07:48 AM)Thomas Klemm Wrote:  Nah, the 42S. Yes, I twigged to that a few minutes later. Thanks for the update - it will save me a bit of fiddling! Also, for any other 41 users: line 41 becomes "FRC" on the 41. And the AIP instruction on line 29 is implemented by the AIP function in the Advantage module, presumably appending the integer part of X to the Alpha register. RE: Factor - Dieter - 04-21-2014 02:48 PM (04-20-2014 07:48 AM)Thomas Klemm Wrote:   (04-20-2014 07:02 AM)Les Bell Wrote:  Is this for the 41, Thomas? Nah, the 42S. Since this is the HP41 Software Library, here is a version that runs on all 41s. Here is the code: Code: ``` 01 LBL "FACTOR"  02 STO 00  03 2  04 CLA  05 ENTER  06 XEQ 01  07 RDN  08 3  09 XEQ 01  10 XEQ 01  11 LBL 00  12 XEQ 01  13 +  14 XEQ 01  15 XEQ 01  16 +  17 XEQ 01  18 XEQ 01  19 +  20 XEQ 01  21 +  22 +  23 XEQ 01  24 XEQ 01  25 +  26 +  27 GTO 00  28 LBL 03  29 RCL 00  30 XEQ 04  31 PROMPT  32 LBL 02  33 +  34 ST/ 00  35 XEQ 04  36 AVIEW  37 >"X"  38 LBL 01  39 RCL 00  40 RCL Y  41 /  42 X