The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

Finding prime factors on a "non-programmable" calculator
Message #1 Posted by Don Shepherd on 4 Sept 2011, 7:13 p.m.

Article describing a new approach to finding prime factors on the "non-programmable" HP-17bii.

      
Re: Finding prime factors on a "non-programmable" calculator
Message #2 Posted by M. Joury on 4 Sept 2011, 7:38 p.m.,
in response to message #1 by Don Shepherd

Thanks Don!

I am continuously learning more about the power of the 17b solver!

Cheers,

-Marwan

      
Re: Finding prime factors on a "non-programmable" calculator
Message #3 Posted by Lode on 4 Sept 2011, 8:04 p.m.,
in response to message #1 by Don Shepherd

Hey, how long does it take to do the same example (6,469,693,230) for each of the factors for which the time in minutes was given for the non optimized version?

            
Re: Finding prime factors on a "non-programmable" calculator
Message #4 Posted by Don Shepherd on 4 Sept 2011, 8:18 p.m.,
in response to message #3 by Lode

Here are the timings, in seconds, for the old version from the Tech. Applications manual, and my version:

factor old version new version ------------------------------------ 2 2 2 3 2 2 5 2 2 7 2 2 11 105 2 13 33 2 17 10 2 19 4 2 23 2 2 29 2 2

      
Re: Finding prime factors on a "non-programmable" calculator
Message #5 Posted by Don Shepherd on 4 Sept 2011, 10:08 p.m.,
in response to message #1 by Don Shepherd

After posting the article, I had to make a change. I thought I could adjust variable TF (beginning trial factor) to the current factor and avoid going back to trial factor 3 each time, but I forgot that the Technical Applications manual states on page 25:

Quote:
Any attempt to alter the values of the (loop control variables) using the LET function causes the solver to create separate variables of the same name.

Therefore, the loop to find factors must always start at 3, the beginning value of the loop control value cannot be adjusted when a factor is found.

            
Re: Finding prime factors on a "non-programmable" calculator
Message #6 Posted by Don Shepherd on 5 Sept 2011, 8:25 a.m.,
in response to message #5 by Don Shepherd

Actually, the original version does work because what you can't do is modify any of the loop control variables from within the loop in an attempt to end the loop early, because the real loop control values are inaccessible to the user while within the loop. But the modified version of the program is preferable because (a) you don't have to press INIT before each execution, and (b) starting the loop for trial factors at 3 each time does not significantly increase the run time since n (and, therefore, (n)) is adjusted whenever a factor is found.

      
Re: Finding prime factors on a "non-programmable" calculator
Message #7 Posted by Allen on 5 Sept 2011, 10:11 a.m.,
in response to message #1 by Don Shepherd

Thanks for the cool article.. You're amazing with the 17b solver!


[ Return to Index | Top of Index ]

Go back to the main exhibit hall