[Math] In how many ways can you group $3$ different numbers from $1$ to $12$ wherein their sum is divisible by $3$

combinationscombinatorics

In how many ways can you group $3$ different numbers from $1$ to $12$ wherein their sum is divisible by $3$?

This question is one of the questions asked in a Math contest for intermediate level, particularly for grade 5 pupils. I know the answer but I do not know how it was solved. I also have tried the counting method but have counted 44 combinations only. Also tried elimination but stuck with 164 combinations, don't know what combinations to subtract from $12C3$. The answer to the question is $76$.
Help please?

Best Answer

Among our $12$, there are $4$ with remainder $0$ on division by $3$, $4$ with remainder $1$, and $4$ with remainder $2$.

We can get a sum divisible by $3$ if we use "$3$ of a kind" (same remainder) or if we use $1$ of each kind.

There are $3\cdot \binom{4}{3}$ ways to choose $3$ of a kind. And there are $4\cdot 4\cdot 4$ ways to choose $1$ of each kind.