IsSq Function


IsSq(x) = 1 (True) if x is a square, else 0 (False).

See: Square Number -- From MathWorld

Here are some notes from my program XICalc - Extra Precision Integer Calculator http://www.oocities.org/hjsmithh/download.html#XICalc :

IsSq(x) is set equal to 1 (True) if x is a perfect square, else it is set to 0 (False). This is computed by factoring x and examining the powers of the prime factors. x is a square iff all of the powers are even. The first prime found with an odd power causes the factoring to stop, and an answer of 0 (False) is given. It may be faster to use the SqRt(x) function and check the remainder in Re for zero if the number is hard to factor.

Return to Number Theory, Algorithms, and Real Functions
Return to Harry's Home Page


This page accessed times since Feb 17, 2006.
Page created by: hjsmithh@sbcglobal.net
Changes last made on Monday, 06-Aug-07 20:47:23 PDT