Triangular number AND sum of first m factorials
01-10-2018, 04:58 AM
Post: #8
 Joe Horn Senior Member Posts: 1,829 Joined: Dec 2013
RE: Triangular number AND sum of first m factorials
(01-10-2018 04:03 AM)Gerson W. Barbosa Wrote:  ISPF? (IsPerfectSquare?) has yet to be implemented. It should return 1 when the argument is a perfect square and 0 otherwise.

The HP 50g LongFloat library contains a function like the one you're looking for. It's called ZSqrt, and it returns IP(sqrt(x)) to level 2, and a 0 or 1 to level 1, with 1 meaning that x was a perfect square. It works on integers of any length.

Gerald H also posted a program HERE which seems to do essentially the same thing. It returns IP(sqrt(x)) to level 2 of the stack, and on level 1 it leaves a SysRPL TRUE if x was a perfect square, otherwise a FALSE. That's the same idea as HP's FPTR2 ^ZSQRT, but Gerald's program is more accurate; see Gerald's posting for evidence of HP's function's inaccuracy.

BTW, LongFloat's ZSqrt function gets the same result as Gerald's program when given the example in Gerald's posting, so I surmise that ZSqrt is trustworthy.

<0|ΙΈ|0>
-Joe-
 « Next Oldest | Next Newest »

 Messages In This Thread Triangular number AND sum of first m factorials - Joe Horn - 01-09-2018, 04:31 PM RE: Triangular number AND sum of first m factorials - Gerson W. Barbosa - 01-09-2018, 08:53 PM RE: Triangular number AND sum of first m factorials - Dieter - 01-09-2018, 10:19 PM RE: Triangular number AND sum of first m factorials - Gerson W. Barbosa - 01-09-2018, 11:00 PM RE: Triangular number AND sum of first m factorials - Valentin Albillo - 01-09-2018, 10:16 PM RE: Triangular number AND sum of first m factorials - John Keith - 01-09-2018, 11:10 PM RE: Triangular number AND sum of first m factorials - Gerson W. Barbosa - 01-10-2018, 04:03 AM RE: Triangular number AND sum of first m factorials - Joe Horn - 01-10-2018 04:58 AM RE: Triangular number AND sum of first m factorials - Paul Dale - 01-10-2018, 06:35 AM RE: Triangular number AND sum of first m factorials - Joe Horn - 01-11-2018, 03:01 AM RE: Triangular number AND sum of first m factorials - Paul Dale - 01-11-2018, 10:21 AM RE: Triangular number AND sum of first m factorials - Gerson W. Barbosa - 01-11-2018, 06:29 PM RE: Triangular number AND sum of first m factorials - John Keith - 01-11-2018, 10:43 PM RE: Triangular number AND sum of first m factorials - John Keith - 01-11-2018, 10:30 PM RE: Triangular number AND sum of first m factorials - John Cadick - 01-11-2018, 02:22 PM

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