Suppose you have a two digit number that ends in 5. Then you can write it as 10a+5. Squaring this, you get (10a+5)^(2)=100a^(2)+100a+25=100a(a+1)+25.

What this means is that if you have a 4 digit number that ends in 25, you can look at the first two digits, and if they are of the form a(a+1), then your number was a perfect square.

For example, with 4225, we drop the 25 to get 42, then since 42=6(6+1), we take 6 and put a 5 on the end. 4225=65^(2).

So it's not that your friend divided by 5 *per se*, but rather that when he divided by 5, he got one less than 5.

Perhaps a better way of thinking it is to ask what the biggest perfect square smaller than the first two digits is. Say, for example, that we wanted to find the square root of 2209. We look at the 22, and that is between 16 and 25, so 40^(2)<2209<50^(2). Now, we look at the last digit of 9. There are two one digit numbers whose squares end in 9: 3 and 10-3=7. Therefore, *if* our number is a perfect square, it must be either 43 = 40+3 or 47=50-3. Which one do we pick to test? Here is where we use our previous calculation for numbers ending in 5. Since the first digit is 4, we look at 4(4+1)=20. Since our number begins with 22, which is bigger than 20, this tells us that if either of the choices works, it must be the bigger choice. So *if* 2209 is a perfect square, then it is (50-3)^2=2500-(2)(50)(3)+9.

Or, for another example, take 5476. We look at the first two digits, and notice that 54 is between 49 and 64, so 70^(2)<5476<80. Now, we look at the last digit, which is 6. The two one digit numbers who square to a number ending in 6 are 4 and 10-4=6. So if we have a perfect square, it is either (70+4)^(2) or (80-4)^(2). Which of the two should we pick? 7\*8=56, but 54<56, so we take the smaller option. We then check (70+4)^(2)=4900+(2)(4)(70)+16=4900+560+16=5476.

It is important to do the final check at the end, because we do not know that we are starting with a perfect square. But if we did know, then there is only one choice to make the first two digits close to what they are, and only two choices to make the final digit what it is.