How many 3-digit numbers appear at the beginning of a 6-digit perfect square?
First we notice that the 6-digit perfect square N has to be less than 1,000²=1,000,000, thus N=n² where n≤999. We consider two cases:
1. n≤500. For every two consecutive perfect squares a²,(a+1)² where a≤499, their difference is equal to
(a+1)²-a²=2a+1≤999<1000
This implies that the sequence of perfect squares grows slow enough to hit all possible 3-digit starting numbers, because if two consecutive perfect squares skip a 3-digit starting number, their difference would need to be at least 1001 apart. Since 500²=250,000, The sequence will therefore hit all 3-digit starting numbers from 100 to 250, giving 151 possible 3-digit starting numbers in this case.
2. n>500. In this case the sequence grows to fast to hit all possible 3-digit starting numbers. However, we can show something of the opposite nature: Every two consecutive perfect squares starting from 500² will have mutually distinct 3-digit starting numbers. This is because for any two consecutive perfect squares a², (a+1)² where a≥500, their difference is equal to
(a+1)²-a²=2a+1≥1001>1000
Whereas if two consecutive perfect squares start with the same 3-digit number, their difference would have been at most 999. Therefore, the perfect squares 501²,...,999² gives rise to 499 possible 3-digit starting numbers.
In conclusion, the total number of 3-digit numbers which appear at the beginning of a perfect square is equal to 151+499=650.
If we think of the process 'squaring and removing the last three digits' as a function, then Case 1 showed that the function is surjective for n≤500, whereas Case 2 showed that the function is injective for n>500.