Prime number finder HP11C?
|
06-19-2016, 02:55 PM
Post: #18
|
|||
|
|||
RE: Prime number finder HP11C?
(06-19-2016 01:14 PM)jbhp55 Wrote: the search for a divisor is always continued up to the square root, but that is the consequence of the fact that you cannot branch out of a sum. You may not be able to branch out of a sigma loop, but you can stop the loop by performing an illegal operation. Here is an example of that. This is a solver equation that shows the prime factors of a number, one factor at a time. Enter the number you want to factor, then press N. Then press FACT. When it finds a factor, it performs an illegal operation (divide by 0) after storing the factor in FACT. The calculator will beep and display "SOLUTION NOT FOUND". You can then RCL FACT and it will show you the factor it found. Then press FACT to find the next factor, then RCL FACT when it displays the error message. It is done when it displays the last factor without you having to RCL it. IF(MOD(N:2)=0:L(FACT:2)+L(N:N\(\div\)2)\(\div\)0:\(\Sigma\)(I:3:SQRT(N):2:IF(MOD(N:I)=0:L(FACT:I)+L(N:N\(\div\)I)\(\div\)0:0))+N)-FACT |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)