Post Reply 
Prime number finder HP11C?
06-19-2016, 07:25 PM
Post: #21
RE: Prime number finder HP11C?
(06-19-2016 06:43 PM)Don Shepherd Wrote:  But if you ever want to write solver equations, especially complex ones, on the 19bii, be aware that there is a major gotcha: it will not store your equation if it has any errors in it. You must correct the error immediately, unlike the solver in the 17bii which goes on and stores your erroneous equation and lets you fix it later.

Thanks Don, this is news to me, though it does explain why I believed one could store erroneous equations and fix the syntax later but then could not do so; I usually use the solver on a 17BII or 27S, but had this exact issue one day when I grabbed a 19BII. I had not realized the solver behavior varied by model this much.

Do you know which of the solver-equipped machines behave which way:

18C, 19B, 19BII, 17B, 17BII, 17BII+(Gold), 187BII+(Silver), 27S ?

In truth, I don't care about 18C and 19B, since I don't use those (as the earliest models they could be flaky?) but the others are all within reach and are part of regular rotation.

Gonna go try this PRIME program on a 27S.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
06-19-2016, 08:03 PM
Post: #22
RE: Prime number finder HP11C?
(06-19-2016 01:14 PM)jbhp55 Wrote:  '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(C:D)x0+L(K:0)x0)))xK+PxK+L(P:P+2)x0

(SIGMA means the Greek capital, of course)

This equation will not verify on my 27S, producing error "Invalid Equation" with cursor blinking on the 1st of 3 adjacent ")" towards the end of the equation.

As I'm not 100% sure of the algorithm, it's hard to figure out exactly what is missing, but the else clause of the IF (after the missing 2nd ":") seems to be missing?

Anyone?

Note: You can prevent similes in equations like this be checking "Disable Smilies" just below the edit box where you type your comments.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
06-19-2016, 08:38 PM
Post: #23
RE: Prime number finder HP11C?
(06-19-2016 07:25 PM)rprosperi Wrote:  Do you know which of the solver-equipped machines behave which way:

18C, 19B, 19BII, 17B, 17BII, 17BII+(Gold), 187BII+(Silver), 27S ?

Bob, the only ones I am sure of are these:

works fine: 17b, 17bii
can't save erroroneous equations: 19bii

I don't have those other machines to test. The plusses, as you know, I gave up on a long time ago.
Find all posts by this user
Quote this message in a reply
06-19-2016, 09:28 PM
Post: #24
RE: Prime number finder HP11C?
There is another ":0" after the "<>". So : "FP(P:D)<>0:0:1+" etc.
I see no other errors, but this one will off course make it invalid. Sorry for the typo.

Best regards,

Jaap
Find all posts by this user
Quote this message in a reply
06-20-2016, 12:05 AM (This post was last modified: 06-20-2016 12:30 AM by rprosperi.)
Post: #25
RE: Prime number finder HP11C?
(06-19-2016 08:38 PM)Don Shepherd Wrote:  Bob, the only ones I am sure of are these:

works fine: 17b, 17bii
can't save erroroneous equations: 19bii

I don't have those other machines to test. The plusses, as you know, I gave up on a long time ago.

Agree the Plusses are a waste of time with the solver, though the 17BII+ Silver remains my daily driver for finance, which in my case never needs the solver....

I will take on testing the others and report results here in the next week or so.

FYI:
the 27S acts the same as the 17BII, which is as expected.
the 17BII+ acts the same (allowing erroneous equations to be saved) but does not produce correct results, both as expected

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
06-20-2016, 12:20 AM
Post: #26
RE: Prime number finder HP11C?
(06-19-2016 09:28 PM)jbhp55 Wrote:  There is another ":0" after the "<>". So : "FP(PBig Grin)<>0:0:1+" etc.
I see no other errors, but this one will off course make it invalid. Sorry for the typo.

Thanks Japp, this works, though when entering the equation, you must use FP(P÷D)<> rather than FP(P/D)<> as shown, else the solver treats "P/D" as a variable.

Initially I understood the directions to mean that subsequent presses of [PRIM] would seek the next Prime number, however a little trial and error shows the program increments by 2 then tests for Prime and reports, and one just repeats hitting [PRIM] until the next is found.

Thanks again for sharing this!

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
06-20-2016, 12:20 AM
Post: #27
RE: Prime number finder HP11C?
(06-20-2016 12:05 AM)rprosperi Wrote:  I will take on testing the others and report results here in the next week or so.

FYI, the 27S acts the same as the 17BII, which is as expected.

Thanks Bob.

I thought that I had posted a thread on this problem a few years ago, but a search of the forum archives did not turn it up, so I guess I didn't. But I did talk to Katie about it and she verified the 19bii behavior also. We must have done it via email instead of a thread.
Find all posts by this user
Quote this message in a reply
06-27-2016, 10:17 PM
Post: #28
RE: Prime number finder HP11C?
(06-17-2016 09:41 AM)Gerson W. Barbosa Wrote:  The HP-15C version might be made even shorter by using Valentin's technique. I learned the MATRIX 1 trick in line 2 from him, BTW.

Gerson, would you care to elaborate? What trick is that?

Thanks
Find all posts by this user
Quote this message in a reply
06-28-2016, 02:22 AM
Post: #29
RE: Prime number finder HP11C?
(06-27-2016 10:17 PM)Marcio Wrote:  
(06-17-2016 09:41 AM)Gerson W. Barbosa Wrote:  The HP-15C version might be made even shorter by using Valentin's technique. I learned the MATRIX 1 trick in line 2 from him, BTW.

Gerson, would you care to elaborate? What trick is that?

Thanks

Márcio,

If you see the reminders on the back of the HP-15C you'll notice the MATRIX 1 operation stores 1 into registers 0 and 1. Its original purpose is to initialize the matrix indices, but you can use it to save two steps (1 STO 0 STO 1 <--> MATRIX 1), in case you need to do this in a program. Even if you need to set only one register to one this may save you one step (considering another register is used anyway). In this case the byte count might be the same, I fear.

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




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