17b2+ solver and the GCD/LCM formula (Don?)


Back in February, Don posted the reply below about the GCD/LCM formula from the 27s/19b Technical applications book not working on the 17b2+ model.

Did anyone ever figure out why that did not work? I know there had been an issue with the sum of digits formula which was worked out, but did anyone figure this one out?

The GCD portion seems to work, but the LCM portion diverges.



unsuccessful with lcm/gcd and factor program
Message #9 Posted by Don Shepherd on 20 Feb 2007, 12:57 a.m.,
in response to message #5 by Bruce Bergman

Bruce, I entered the two solver equations from the 27s/19b applications book for finding lcm/gcd and prime factors, and neither would work on the 17bii+. I double-checked to make sure I entered them correctly, but they do not give correct results. So I'm thinking maybe there are some differences in capability between the solver in the 27s/19b and 17bii+. Don't know, but disappointing.


Don can pipe in here, but I think he didn't get it working either. Both of us spent a fair amount of time scratching our heads on why they didn't work. From what I understand, they work perfectly on the 17bii (not the + model), but for whatever reason, they don't fly on the + model.

Don and I have had several conversations about this. There appears to be either some flaws or design choice differences in the 17bii+ solver application. It doesn't behave exactly like the 17bii. You can tweak some of the programs and it does fine, but it does need tweaking. I don't know that I'd call it a bug, per se, but it behaves differently.

Don has examples of the SOD program for both models. He can probably explain more. Also, check article 712 for some additional data.



Besides the differences of the 17bII+ to the earlier models in handling G(et) and L(et), some other potential reasons could apply:

1. Ambiquity in "Evaluation Order" (see top of p.22 in 27s/19b TM)

2. Differences in 17bII+ ROMs

I'll try it out on serial #CNA42903649 and report later.

Best regards

Peter A. Gebhardt

(9:23pm GMT+1): Tried it - failed with LCM too. I keyed in the equation as in manual. GCD started iterating. Then I solved a "dummy" equation: a*b*a1*b1*z=0 first. GCD calculated correctly. LCM still failed "iterating". Got rid of "=if(..." by replacing "=" with "-" to put all G & L terms on one side of the equation. Tried again as described above - same "no go" result for LCM!

Edited: 9 Aug 2007, 3:24 p.m.


Gene, Bruce is right. I could never get the lcm/gcd program or the prime factor program (both from the 27s/19b Technical Apps Manual) to work on the +. There was some discussion by several folks about how the solver on the + does not really work like the solver on the original bii, and that is true. The recommendation was that if you want it to work like it really should, get a bii, which I did. And both equations work fine on the bii.

As to why they don't work on the +, I often wondered about that, but I never discovered the answer, at least explained to my satisfaction. I remember writing a little routine on the + and it would not give the obvious answer, but I can't remember exactly what that was (I guess I don't save things that DON'T work!).

I will say that the bii solver works as a programmer would expect it to. It is also faster than the + at solver equations containing the sigma function.


Sigh ...

So we can only "pray" that the "new & improved" HP17bII plus does come with a functioning solver in place (I would like to see the full-fledged 19BII solver in "sheep's clothes" ... - "I have a dream" ... )

Best regards

Peter A. Gebhardt


OK, this simple solver formula demonstrates the erroneous behavior of the solver on the hp-17bii+:


Enter the formula into the solver, press CALC, do a Clear Data (to insure S is 0), press A softkey, it will (correctly) say that A=0, then press RCL S, it will show S=110. The correct answer is (or should be) S=55, which is what you get if you run it on the 17bii.

As to how S gets to be twice what it should be, I don't know!


Don and I had some discussions about why this was happening. I don't know enough about the internals of the 17bii+, but I first noticed the unusual behavior doing the Sum Of Digits program. If you just changed around the variables, used another L() and G(), it seemed to work.

I suspect there is some difference in how variables are represented (or accessed) in the bii versus the bii+ models. I don't know if the 17bii behaves the same as the 19bii in this regard. It would be interesting to get the following calcs lined up and run the same programs on each:

19b 19bii 17b 17bii 17bii+ (and the new silver 17bii++?)

If we could somehow document the differences in how the solver functions on each machine, at least we could hand that out as a cheatsheet for those trying for portability amongst that family. I know it would have saved me a big headache a year or so ago...



What's the difference between the 17BII solver and the one in the 19BII? I thought they were identical (or so Craig Finseth's site claims).


- Thomas



The differences are the "missing" functions like RAND, TRIGs etc., the TVM(.) functions (with 5 variables like the ones in EXCEL) and Rectangle/Polar conversion. The interface of the Solver to the PLOT routines in the 19bII, is not applicable to the 17bII+ "plus", because of different screen/LCD characteristics.

Otherwise - you are right here - there are no differences to the SOLVER logic according to Finseth.

Sorry, that I was somewhat unspecific in my comment. Hope I covered it all, because I draw my knowledge mainly from the 27s/19b & 200LX manuals and from Coffin's "An Easy Course in Using the HP 19BII".

Best regards

Peter A. Gebhardt


Hi Peter,

Thanks for clearing that up! I was worried with the 17BII I would be missing something. :-)

But trig functions on a business calculator? That's neat. I wonder, is that a nod to the geeks in finance, or are there actual financial applications for those functions?

- Thomas



Yes there could be financial applications, like using them for "on the fly" calculation of the "weights" for a Gaussian Quadrature in numerical integration and other stochastical applications.


Best regards

Peter A. Gebhardt

Edited: 10 Aug 2007, 3:13 a.m.


Gene, can you post original formula. I would like to see what it is to analyze what might be problem. I have been unable to find it in the archives.


Vincze, this is the formula that works on the hp-17bii, but not on the hp-17bii+. It calculates the sum of the digits of input n:



Thank you. I guess if I understood english better I would know what GCD/LCM mean. Can someone please explain.

Can you explain also the different parts of the formula. Also, what are the colons for?


Vincze, GCD is greatest common divisor, and LCM is least common multiple. The GCD of two numbers is the largest number that divides into the numbers evenly, and the LCM is the smallest number that is a multiple of both numbers.

You need to look at the HP-17bii+ manual, which is on the museum DVD and probably HP's site, to understand the formula.


Thank you... okay, I understand what greatest common divisor and least common multiple are. I was just not aware of the abbreviations.


So I don't understand one thing. How does SOD tell me GCD or LCM, or is this part of another program that do that?

BTW, I ask friend if I can buy 17BII that he let me borrow. He tell me to go do something to myself that I don't think is possible. ;-)

Edited: 10 Aug 2007, 3:50 p.m.


The SOD (sum of digits) program has nothing to do with GCD or LCM. GCD/LCM is another solver program, available on the museum DVD in the HP 27S/19B Technical Applications manual.


Okay... I thought I was going stupid or something.



GCD == Greatest Common Denominator (Größtes gemeinsames Vielfaches)

LCD == Least Common Denominator (Kleinstes gemeinsames Vielfaches)

The colons (:) are delimiters to separate the parameters of the function call properly - like in f(a,b, ...,z).

Best regards,

Peter A. Gebhardt

PS: Excuse me for offering a German translation as well, but I suppose German could have been part of your education, because of the historical relations between Hungary and Austria.


Guten Morgen Peter und danke. Es ist mir bekannt welche Deutsch, aber nicht jene menge noch mehr. {I hope I said that correctly;) I guess I remember more than thought I did. }

I have not used it for very long. An older man in village where I grew up spoke it, and I learned from him and others. Believe it or not, many people now speak English, at least in larger cities like Budapest. Main language is still Hungarian, but most people know enough English.


When I try on 28C, it says invalid equation. Friend have 17BII and I try there and same issue.

You have equation as:


Does it need to be

Actually, after it says error, it goes right after sigma and flash on the left (

Edited: 10 Aug 2007, 12:15 p.m.



According to Graig Finseth, the 28c DOES NOT have L() & G() commands available in it's solver - only the 27s, 19b, 17b, (the palmtops) 95,100,200LX.

Sorry for you :-((

For the 28c:


Similar to algebraic, except that different keystrokes are used:

<value> stores the value in the variable
<value> '<name>' STO stores the value in the variable
Shift-<name> solves for the variable
'<name>' RCL recalls a value from the variable
'<name>' EVAL recalls a value from the variable and evaluates it

For the "Business Line":


This solver is similar to TVM5, except that it has been generalized to
handle any equation.

<name> stores the value in the variable
STO <name> stores the value in the variable
<name> (2nd in a row), solves for the variable
RCL <name> recalls a value from the variable

The solvers on the 17BII, 19B, 19BII, and -27S also have L(et) and
G(et) functions.

The solvers on the -17B, 17BII, -18C, 19B, and 19BII do algebraic
simplification: this feature was removed from the -27S in order to
save space.

The solver on the 17BII / 19B / 19BII is the best one of the set.


Why it doesn't work on the 17bII is not clear to me. I tried your first equation on an 200LX (my reference, because I don't posess any other "reference" besides a 17bII+) and it works fine. The 200LX solver is being regarded as a perfect clone of the 19bII solver.

Best regards

Peter A. Gebhardt

Edited: 10 Aug 2007, 12:57 p.m. after one or more responses were posted


On 17BII, it look like Error right after Sigma. Do I just spell Sigma out, or is the symbol someplace that I need to enter? I apologize for being such stupid Hungarian.

Edited: 10 Aug 2007, 12:33 p.m.



Never ever regard yourself as stupid when asking questions - there are no stupid questions - only stupid answers!

Your suspicions are right: Very often we post Solver programming examples (for the business line) using "sigma" instead of the greek symbol for sigma.

So pls. press the right-most soft-menu button (alpha) 4 times (when in EDIT mode on the 17bII) and you wil see the required symbol.

Best regards

Peter A. Gebhardt


Thank you so much my friend! It now work.

Again, I sorry for dumbing down group. I know you say I no stupid, but I wish I was smart like rest of you. I am more programmer, and not as fancy with math and physics. My Papa was big shot physics person. Back in 1970's men come for him to have him help them with something very secret. Papa would not help them and they bound him up, and my mother up and laid them on train tracks. They kept asking for his help, and he say NEM! to them. So they kill Papa and my mother by driving train very slowly over them. He was very smart man, but I swore that I would not go into physics because of what happen to him. Computer science seem more safe that physics and nuclear things.

Thank you again for putting up with me. I consider you all very good friends.

Possibly Related Threads...
Thread Author Replies Views Last Post
  hp-prime solver and variable name fabrice48 22 5,759 12-10-2013, 03:25 AM
Last Post: fabrice48
  how to manage formula in prime fabrice48 5 1,859 12-05-2013, 01:09 PM
Last Post: Steve Simpkin
  HP Prime Triangle solver BruceH 29 5,970 11-28-2013, 12:03 AM
Last Post: Dale Reed
  Another Prime mystery - templates don't work anymore Michael de Estrada 2 1,011 11-02-2013, 11:34 AM
Last Post: Michael de Estrada
  Using units in Numeric Solver Harold A Climer 1 883 10-13-2013, 10:44 AM
Last Post: Tim Wessman
  Prime Updates (don't get excited yet) Tim Wessman 3 1,123 09-26-2013, 06:18 PM
Last Post: Han
  Does Prime Have a Multiple Equation Solver? Norman Dziedzic 2 979 09-20-2013, 09:43 AM
Last Post: Norman Dziedzic
  Just a lazy solver algortihm PGILLET 1 815 06-28-2013, 11:47 PM
Last Post: Namir
  Warning - Don't update RPN-67 Pro on your iPad Michael de Estrada 9 2,083 05-02-2013, 03:21 PM
Last Post: BShoring
  [43s] : How the solver will be implemented Miguel Toro 3 1,169 03-14-2013, 06:09 PM
Last Post: Walter B

Forum Jump: