6
$\begingroup$

Can someone check which logic is finally correct?:

In how many ways can three numbers be selected from the numbers $1,2,\dots,300$ such that their sum is divisible by $3$?

I found different answers about the exact question but everyone states something different.

Dividing $\{1, \dots , 300\}$ into three groups $(A,B,C)$ where each one of them has $100$ numbers in it and ${}\bmod 3$ results in $0$ or $1$ or $2$ seems correct as a first step.

Then if we want the sum of the three numbers to be divisible by $3$ we should take cases:

  • All of them belong to one of the groups: $ {{100}\choose{3}} + {{100}\choose{3}} + {{100}\choose{3}} $
  • We take one from each group: $ {{100}\choose{1}} × {{100}\choose{1}} × {{100}\choose{1}} $

The answer ends there by adding the above numbers (because one of them can happen).

But what about combinations such as: Taking one number from the group that gives remainder $1$ and two numbers from the group that gives remainder $2$??

$\endgroup$
9
  • 1
    $\begingroup$ Are the three numbers necessarily distinct? $\endgroup$ Aug 31, 2013 at 19:50
  • $\begingroup$ Wouldn't the second bullet be $\binom{100}{1}\times\binom{100}{1}\times\binom{100}{1}$? $\endgroup$ Aug 31, 2013 at 19:52
  • $\begingroup$ If you see it as group, when you pick one number then you can't pick it again. So, I believe yes they are distinct. Sorry for the typo in the formula.... $\endgroup$ Aug 31, 2013 at 19:53
  • $\begingroup$ If it is a group, you are still allowed to choose three with replacement... $\endgroup$ Aug 31, 2013 at 19:54
  • $\begingroup$ each one must be different $\endgroup$ Aug 31, 2013 at 19:54

4 Answers 4

7
$\begingroup$

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 $\binom {300}1 \times \binom {200}1 \times\binom {100}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 $\binom {100}3$ ways of choosing a triple.

So the overall number of ways is $$\frac 16\times\binom {300}1 \times \binom {200}1 \times\binom {100}1+3\times\binom {100}3$$

And this is equal to $$\binom {100}1 \times \binom {100}1 \times\binom {100}1+3\times\binom {100}3$$

$\endgroup$
4
$\begingroup$

The remainders of these numbers must be only: $(0,0,0),(0,1,2),(1,1,1),(2,2,2)$. In every case you can chose ${100}\choose{3}$ triples. So you get $4\cdot {{100}\choose{3}}$ triples.

There is a mistake in my reasoning. See the remark of Douglas S. Stones below (thank to him).

$\endgroup$
3
  • 3
    $\begingroup$ In the $(0,1,2)$ case, we can choose $100^3$ triples. $\endgroup$ Aug 31, 2013 at 20:14
  • $\begingroup$ Aside from the above, I found yours the best answer. Right to the point! $\endgroup$ Aug 31, 2013 at 20:32
  • $\begingroup$ @Douglas S. Stones: Once more thank you. $\endgroup$ Aug 31, 2013 at 20:38
2
$\begingroup$

The combination of one number with remainder 1 and two numbers with remainder 2 gives a sum with remainder 2, so it is not a multiple of 3. You listed the possibilities for getting a sum that is a multiple of 3 correctly. At Thomas Andrews says, one of each group is the product of three ${100 \choose 1}$'s as you are choosing one from each group.

$\endgroup$
2
  • $\begingroup$ So all possible ways are only those that are listed? $\endgroup$ Aug 31, 2013 at 20:00
  • $\begingroup$ This answer is a good complement to Mark Bennet's answer. $\endgroup$ Aug 31, 2013 at 20:16
1
$\begingroup$

The number can be computed directly in GAP via:

Size(Filtered(Combinations([1..300],3),S->Sum(S) mod 3=0));

which returns 1485100. This matches $3\binom{100}{3}+100^3$.

$\endgroup$
3
  • $\begingroup$ Is there a matlab equivalent? $\endgroup$ Aug 31, 2013 at 20:25
  • $\begingroup$ I'd say the answer to that question is yes (but I don't know what it is). $\endgroup$ Aug 31, 2013 at 20:26
  • 1
    $\begingroup$ @DouglasS.Stones: Thanks! BTW, using iterator of combinations is slightly faster and less memory expensive, since it does not require to create the list of all 4455100 combinations first. Try n:=0; for s in IteratorOfCombinations([1..300],3) do if Sum(s) mod 3 = 0 then n:=n+1; fi;od; n; $\endgroup$ Sep 2, 2013 at 12:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .