How many ways to select 3 numbers from $1-30$ so that the sum of them is a multiple of 3? How many ways to select 3 numbers from $1-30$ (each number is used only one time) so that the sum of them is a multiple of 3?
I got the answer is $1360$ by programming (check the sum of every combination), and
I also know the formula is $10^{3}+3\cdot\binom{10}{3}$, but how to explain it?

i find this answer for 1-300 and sum is divisible by 3 i hope it can help you
In how many ways can three numbers be selected from the numbers 1,2,…,300
such that their sum is divisible by 3?

So we can choose the first two numbers how we like. The third has to have a definite residue class mod
3
to make the total divisible by
3
.
If the third residue class is distinct from the residue class the first two numbers, the first two have to be from different residue classes. The number of ways of choosing one from each residue class is ${300 \choose 1} $${200 \choose 1} $${100 \choose 1} $ but there are six different orders in which the same three numbers can be selected.
If the final residue class is the same as one of the previous ones, they all have to be the same. We choose one of the three residue classes, and there are then ${100\choose3}$
ways of choosing a triple.
So the overall number of ways is
$\frac{1}{6}×{300\choose1}×{200\choose1}×{100\choose1}+3×{100\choose3}$
And this is equal to
${100\choose1}×{100\choose1}×{100\choose1}+3×{100\choose3}$
you can find this answer here answer
