A positive integer $n$ is said to be good if there exists a perfect square whose sum of digits in base $10$ is equal to $n$. For instance, $13$ is good because $7^2=49$ and $4+9=13$. How many good numbers are among the list $\{1, 2, 3, \dotsc, 2007\}$?
I input all the numbers from $1$ to $2007$ into an Excel spreadsheet, squared all the numbers, split the squares into individual digits, added the digits and checked-off on the numbers which are repeating in the original list of numbers from $1$ to $2007$, and the sum of digits of the squares.
But this method takes too long. Is there a smarter way to answer this question?