TITLE: Efficient way to determine if a number is Perfect Square
QUESTION [36 upvotes]: Is there an efficient method to determine if a very large number (300 - 600 digits) is a perfect square without finding its square root. I tried finding the square root but I realized that even for perfect squares, it wasn't efficient (I used newton's approximation method and it was coded in JAVA). I read somewhere about using modular arithmetic but I'm not quite sure how to do that. Can anyone give me a hint on how to proceed?
Thanks in advance.

REPLY [2 votes]: An algorithm based on subtractions only.
Let $n$ be the number, $a=5n$ and $b=5$.
While $a\geq b$, replace $a$ with $a-b$ and add $10$ to $b$.
When you get $a<b$, then $n$ is a square if and only if $a=0$.