HP Forums

Full Version: nextprime function now working as expected with Ans
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have just recently acquired an HP prime. I tried the nextprime(2) and it worked as expected giving the answer 3. I then tried nextprime(Ans), expecting to get 5. It returned 2. It seems nexrprime and Ans are not communicating for sme reason.

Or is there something I am doing wrong?
(07-26-2022 02:10 AM)lbundle Wrote: [ -> ]I have just recently acquired an HP prime. I tried the nextprime(2) and it worked as expected giving the answer 3. I then tried nextprime(Ans), expecting to get 5. It returned 2. It seems nexrprime and Ans are not communicating for sme reason.

Or is there something I am doing wrong?

On the version of prime I am using on my phone
Software Version: 2.1.14346 (2019 11 21)
Hardware Version: Emu

nextprime(Ans) always returns 1.15951471769ᴇ15.
regardless of what Ans is preset to!
nextprime(Eval(Ans)) gives the expected result 5 when Ans is set to 3
The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS. Since nextprime() is a CAS function, nextprime(Ans) always uses CAS's Ans, not Home's Ans. Does this mean that the HP Prime has multiple personality disorder? Yes, and it's scary because CAS's personality sneaks across into Home without warning, as you discovered.

Solution to this problem is simple: nextprime() and nextprime(Ans) work as desired in CAS view.
(07-26-2022 04:12 AM)Stevetuc Wrote: [ -> ]nextprime(Ans) always returns 1.15951471769ᴇ15.
regardless of what Ans is preset to!
nextprime(Eval(Ans)) gives the expected result 5 when Ans is set to 3

The former (above) is using the Ans from CAS. Go into CAS, set its Ans to something, then go back to Home and set its Ans to something else. nextprime(Ans) will use the Ans from CAS, not the Ans from Home, even though you're in Home view.

The latter (above) is forcing Prime to use Home's Ans.

Crazy Prime. Sad
(07-26-2022 04:19 AM)Joe Horn Wrote: [ -> ]The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS.

We can get CAS Ans from Home side, with id(Ans)

Is there a way to get value of Home Ans, from CAS side?
(without switching to Home side to grab it, then switch back)
(07-26-2022 04:19 AM)Joe Horn Wrote: [ -> ]The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS. Since nextprime() is a CAS function, nextprime(Ans) always uses CAS's Ans, not Home's Ans. Does this mean that the HP Prime has multiple personality disorder? Yes, and it's scary because CAS's personality sneaks across into Home without warning, as you discovered.

Solution to this problem is simple: nextprime() and nextprime(Ans) work as desired in CAS view.

Is this supposed to be a feature or a bug? If it's a feature I cannot possibly see a use for it.
(07-26-2022 04:19 AM)Joe Horn Wrote: [ -> ]The problem is caused by Prime having two different values of Ans, one for Home, and one for CAS. Since nextprime() is a CAS function, nextprime(Ans) always uses CAS's Ans, not Home's Ans. Does this mean that the HP Prime has multiple personality disorder? Yes, and it's scary because CAS's personality sneaks across into Home without warning, as you discovered.

This is why I always recommended that either

1) CAS and home be totally separate modes with no interaction. Those of us who have no need of CAS could ignore it.

or

2) CAS and home be totally integrated so that there was no division at all. You'd always be in a mode that could solve problems both numerically and exactly. Use a decimal point for approximation, or none for exact.

3.0 ÷ 4 = .75
3 ÷ 4 = ¾

TI's calculators have no problem doing this and neither do Casio's so I know it's not impossible.
The 50g too.

I suspect the main reason was to use an existing, well-respected CAS pkg, rather than spend limited resources on developing a competing one, but that does then lead to the Home/CAS split.
The reason for the Home/CAS split is to comply with requirements for standardized testing. HP's market is education, not technical professionals. Much as I like the speed, larger memory and better display, I still use the 50g much more than the Prime.
Reference URL's