{{searchResults.length}} {{searchResults.length === 1 ? 'result' : 'results'}} for “{{searchWords}}”No results found for “{{searchWords}}”× back to contents
Allowed digits have residues $0$: $\{0,3,6,9\}$, $1$: $\{1,4,7\}$, $2$: $\{2,8\}$; the units digit is in $\{1,3,7,9\}$ with residues $1,0,1,0$.
The units digit has residue $0$ ($3$ or $9$) in $2$ ways and residue $1$ ($1$ or $7$) in $2$ ways. So the first three digits must have digit sum $\equiv0\pmod3$ (with units $3$ or $9$) or $\equiv2\pmod3$ (with units $1$ or $7$).
\emph{Hundreds and tens digits.} Each has residues $0,1,2$ in $4,3,2$ ways. Their sum has residue \begin{align*} 0&:\ 4\cdot4+3\cdot2+2\cdot3=28,\\ 1&:\ 4\cdot3+3\cdot4+2\cdot2=28,\\ 2&:\ 4\cdot2+2\cdot4+3\cdot3=25 \end{align*} ways (check: $28+28+25=81=9^2$).
\emph{Add the thousands digit} (nonzero), with residues $0,1,2$ in $3,3,2$ ways. The first three digits have sum with residue \[ 0:\ 3\cdot28+3\cdot25+2\cdot28=215,\qquad 2:\ 3\cdot25+3\cdot28+2\cdot28=215 \] ways. (For residue $0$: thousands residue $0,1,2$ needs the other two to have residue $0,2,1$; similarly for residue $2$.)