Is the resulting $3$-digit number divisible by $3$?

From the 2012 Australian Mathematical Competition (Junior Level):

How many four-digit numbers containing no zeros have the property that whenever any its four digits is removed, the resulting three-digit number is divisible by $$3$$?

To solve this problem, I listed 4 cases

1. If the 1st digit is deleted then the remaining number would have to be a multiple of $$3$$. That means that there are $$10 \cdot 10 \cdot 3 = 300$$ cases.

2. If the 2nd digit is deleted then the remaining number would have to be a multiple of $$3$$. That means that there are $$10 \cdot 10 \cdot 3 = 300$$ cases.

3. If the 3rd digit is deleted then the remaining number would have to be a multiple of $$3$$. That means that there are $$10 \cdot 10 \cdot 3 = 300$$ cases.

4. If the 4th digit is deleted then the remaining number would have to be a multiple of $$3$$. That means that there are $$10 \cdot 10 \cdot 3 = 300$$ cases.

So there are $$1200$$ cases but this is wrong.

• You include for example 1234 in the count of the first set because it is a multiple of 3 when the first digit is removed. It does not have the property that you can remove any other digit and have it be divisible by 3. Commented May 6, 2023 at 8:09
• All 4 digits must have the same value when considered modulo 3, Commented May 6, 2023 at 8:14

A number is divisible by 3 iff its sum of digits is divisible by 3. Using this fact, it is easy to see that our 4-digit number satisfies the given condition iff the four digits all have the same remainder modulo 3. Therefore, we have $$3*(9/3)^4=243$$ cases when each digit is nonzero.
• Great answer! Just something to clarify. Why is the equation you added $3∗(9/3)^4=243$ and how did you figure this out? Thanks. Commented May 6, 2023 at 8:33
• @JonathanXu The $(9/3)^4=81$ part refers to four numbers with each say $\equiv 0 \mod 3$. The tripling then accounts for numbers with $\equiv 1 \mod 3$ and $\equiv 2\mod 3$. Example for the latter: 5555, which always yields 555 (div. by 3), but 5 $\equiv 2 \mod 3$. Commented May 6, 2023 at 10:05