HP Forums

Full Version: 17bii+ solver workaround
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

The solver in the 17bii+ is different than the solver in the original 17bii. It always solves equations using the iterative solver, never the direct solver. As a result, every equation is evaluated twice (at least). This causes problems if you change the value of an input variable using the L() function. For example, the equation A=L(B:B+1) returns A=1, as expected, but if you RCL B you see that it is 2.

For new equations, you can stay out of trouble if you initialize variables and never update an input variable with the L() function. Older equations, that worked on the original 17bii, may not work on the + if they don't abide by these rules.

The Technical Applications Manual for the 27S and 19B contains a solver equation to determine the prime factors of a number. As written, the equation does not work on the 17bii+, because it updates input variable N at the end of the equation. Experimentation with this equation revealed that it finds every other prime factor of a given number. For example, the prime factors of 510510 are 2, 3, 5, 7, 11, 13, 17. On the 17bii+, the equation finds every other factor: 2, 5, 11, and 17. So I needed to find a way to trick the solver into not evaluating the equation on even numbered iterations.

This was the solution I found that worked. At the beginning of the equation, add the following:

FACT=0xL(B$$:G(B$$)+1)+IF(MOD(G(B$$):2)=1:

at the very end of the equation, add :0)

This essentially only executes the bulk of the equation code during odd iterations, and the correct factors are derived. I used B$$ since it is unlikely to be used in other equations, and it is necessary for B$$ to be 0 or an even number for this workaround to work.