Post Reply 
Prime number finder HP11C?
06-19-2016, 01:14 PM
Post: #16
RE: Prime number finder HP11C?
Dear Don,

'the whole thing' is in fact quite short:

0xP+L(K:1)x0+PRIME=(L(C:1)-C+SIGMA(D:3:SQRT(P)+1:2:IF(FP(P/D)<>0:1+L(CBig Grin)x0+L(K:0)x0)))xK+PxK+L(PTongue+2)x0

(SIGMA means the Greek capital, of course)

Use: type starting number (must be odd), press P
outcome is 0 if P is not a prime, otherwise P is given. Press PRIM to continue search. (new P is two higher than original)

This equation has evolved and is not optimized for shortness. Also, I don't remember why C and K are output. The advanced guide for the 19B and 28C/S gives the way to suppress them (quite easy). The main algorithm is standard for the solver. It seems quite rough, as 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. Nevertheless, the search is quite quick, as I mentioned earlier.

best regards,

Jaap.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Prime number finder HP11C? - jbhp55 - 06-13-2016, 07:15 PM
RE: Prime number finder HP11C? - jbhp55 - 06-14-2016, 06:33 AM
RE: Prime number finder HP11C? - TASP - 06-14-2016, 11:35 PM
RE: Prime number finder HP11C? - jbhp55 - 06-16-2016, 07:56 PM
RE: Prime number finder HP11C? - jbhp55 - 06-17-2016, 07:08 AM
RE: Prime number finder HP11C? - Dieter - 06-17-2016, 06:42 PM
RE: Prime number finder HP11C? - Marcio - 06-27-2016, 10:17 PM
RE: Prime number finder HP11C? - jbhp55 - 06-17-2016, 10:43 AM
RE: Prime number finder HP11C? - rprosperi - 06-18-2016, 10:27 PM
RE: Prime number finder HP11C? - bshoring - 06-18-2016, 07:23 PM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016 01:14 PM
RE: Prime number finder HP11C? - rprosperi - 06-19-2016, 08:03 PM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016, 01:17 PM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016, 05:35 PM
RE: Prime number finder HP11C? - rprosperi - 06-19-2016, 07:25 PM
RE: Prime number finder HP11C? - rprosperi - 06-20-2016, 12:05 AM
RE: Prime number finder HP11C? - jbhp55 - 06-19-2016, 09:28 PM
RE: Prime number finder HP11C? - rprosperi - 06-20-2016, 12:20 AM



User(s) browsing this thread: 1 Guest(s)