An Anderson number is a positive integer $k$ less than 10000 with the property that $k^{2}$ ends with the digit or digits of $k$. For example, 25 is an Anderson number because 625 ends with 25 , but 75 is not an Anderson number because 5625 does not end with 75. If $S$ is the sum of all even Anderson numbers, what is the sum of the digits of $S$ ?
(A) 17
(B) 18
(C) 11
(D) 33
(E) 24
The squares of the one-digit positive integers $1,2,3,4,5,6,7,8,9$ are $1,4,9,16,25,36,49,64,81$, respectively.

Of these, the squares $1,25,36$ end with the digit of their square root.

In other words, $k=1,5,6$ are Anderson numbers.

Thus, $k=6$ is the only even one-digit Anderson number.

To find all even two-digit Anderson numbers, we note that any two-digit even Anderson number $k$ must have a units (ones) digit of 6 . This is because the units digit of $k$ and the units digit of $k^{2}$ must match (by the definition of an Anderson number) and because the units digit of $k$ completely determines the units digit of $k^{2}$. (We can see this by doing "long multiplication".) So we need to look for two-digit Anderson numbers $k$ with digits $c 6$.

Another way of writing the number $c 6$ is $k=10 c+6$. (This form uses the place values associated with the digits.)

In this case, $k^{2}=(10 c+6)^{2}=(10 c+6)(10 c+6)=(10 c)^{2}+6(10 c)+10 c(6)+6^{2}=100 c^{2}+120 c+36$. Note that $k^{2}=100\left(c^{2}+c\right)+10(2 c+3)+6$ and so the units digit of $k^{2}$ is 6 .

For $k$ to be an Anderson number, we need the tens digit of $k^{2}$ to be $c$, in which case the final two digits of $k^{2}$ will be $c 6$.

Thus, the tens digit of $k^{2}$ is equal to the units digit of $2 c+3$.

This means that $k=10 c+6$ is an Anderson number exactly when the units digit of $2 c+3$ is equal to the digit $c$.

When we check the nine possible values for $c$, we find that the only possibility is that $c=7$.

This means that $k=76$ is the only two-digit even Anderson number.

Note that $76^{2}=5776$, which ends with the digits 76 .

Next, we look for three-digit even Anderson numbers $k$.

Using a similar argument to above, we see that $k$ must have digits $b 76$.

In other words, $k=100 b+76$ for some digit $b$.

In this case, $k^{2}=(100 b+76)^{2}=10000 b^{2}+15200 b+5776$.

We note that the tens and units digits of $k^{2}$ are 76 , which means that, for $k$ to be an Anderson number, the hundreds digit of $k^{2}$ must be $b$.

Now $k^{2}=1000\left(10 b^{2}+15 b+5\right)+100(2 b+7)+76$.

Thus, $k$ is an Anderson number exactly when the units digit of $2 b+7$ is equal to the digit $b$.

Again, checking the nine possible values for $b$ shows us that $b=3$ is the only possibility.

This means that $k=376$ is the only three-digit even Anderson number.

Note that $376^{2}=141376$, which ends with the digits 376 .

Since Anderson numbers are less than 10000 , then we still need to look for four-digit even Anderson numbers.

Again, using a similar argument, we see that $k$ must have digits $a 376$.

In other words, $k=1000 a+376$ for some digit $a$.

In this case, $k^{2}=(1000 a+376)^{2}=1000000 a^{2}+752000 a+141376$.

We note that the hundreds, tens and units digits of $k^{2}$ are 376 , which means that, for $k$ to be an Anderson number, the thousands digit of $k^{2}$ must be $a$.

Now $k^{2}=10000\left(100 a^{2}+75 a+14\right)+1000(2 a+1)+376$.

Thus, $k$ is an Anderson number exactly when the units digit of $2 a+1$ is equal to the digit $a$.

Again, checking the nine possible values for $a$ shows us that $a=9$ is the only possibility.

This means that $k=9376$ is the only four-digit even Anderson number.

Note that $9376^{2}=87909376$, which ends with the digits 9376 .

Thus, $S$, the sum of the even Anderson numbers, equals $6+76+376+9376=9834$.

The sum of the digits of $S$ is $9+8+3+4=24$.