6

We have 5 different subgroups of the 500 numbers, where each number has a specific remainder 0 to 4 mod 5. Each subgroup consists of 100 numbers. So we must select all 5 numbers from each of the below remainders sets: (0,0,0,0,0), (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3) and (4,4,4,4,4). But apart from the above, we also have (1,1,1,2,0), (1,2,2,0,0), (1,2,3,4,0), (2,2,2,4,0) etc. All in all, we have the below:

(0,0,0,0,0)

(0,0,0,1,4)

(0,0,0,2,3)

(0,0,1,1,3)

(0,0,1,2,2)

(0,0,2,4,4)

(0,0,3,3,4)

(0,1,1,1,2)

(0,1,1,4,4)

(0,1,2,3,4)

(0,1,3,3,3)

(0,2,2,2,4)

(0,2,2,3,3)

(0,3,4,4,4)

(1,1,1,1,1)

(1,1,1,3,4)

(1,1,2,2,4)

(1,1,2,3,3)

(1,2,2,2,3)

(1,2,4,4,4)

(1,3,3,4,4)

(2,2,2,2,2)

(2,2,3,4,4)

(2,3,3,3,4)

(3,3,3,3,3)

(4,4,4,4,4)

So the total number of ways is:

$\frac {1} {120}\times\binom {500}1 \times \binom {400}1 \times\binom {300}1 \times\binom {200}1 \times\binom {100}1$ but this is only for the case where we select all 5 numbers from the same subset of remainders. How do we add the rest of the cases?

Jyrki Lahtonen
  • 133,153
Samuel
  • 1,491
  • It may be easier to compute if you recognize the symmetry: numbers are one of $-2,-1,0,1,2 \pmod 5$. You must then find ways of summing up to $-10, -5,0,5, 10 \pmod 5$. At that point, starting your solution brute force does not seem that bad since the math that comes afterwards is fairly straightforward. – Andrew Chin Dec 06 '19 at 19:20
  • Are you allowed to repeat a number? – arkeet Dec 06 '19 at 19:20
  • To clarify, are you allowed to repeat numbers? Does the order of the numbers matter? For instance, does the selection $(100,101,102,103,104)$ count as a different selection than $(104,101,102,103,100)$? If the answer is yes to both of those, just pick the first four numbers without restriction. Then, recognize that the fifth number must belong to a specific modulo class, giving a total of $500^4\cdot 100$ – JMoravitz Dec 06 '19 at 19:24
  • The order does not matter. – Samuel Dec 06 '19 at 19:26
  • For example, for (0,0,0,1,4) is it $\frac {1} {120}\times\binom {100}3 \times \binom {100}1 \times\binom {100}1 $? – Samuel Dec 06 '19 at 19:31

3 Answers3

2

The following MSE link asks about the probability that a set of size $n$ drawn from $[kn]$ has sum divisible by $n$. We proved the following closed form:

$$\bbox[5px,border:2px solid #00A000]{ (-1)^n {kn\choose n}^{-1} \frac{1}{n} \sum_{d|n} {kd\choose d} (-1)^d \varphi(n/d).}$$

In the present case we have $n=5$ and $k=100$ which gives

$${500\choose 5}^{-1} 51 \; 048 \; 937 \; 600 = \frac{127622344}{638111719}.$$

Marko Riedel
  • 61,317
1

A $5$-element subset of $[500]$ is called a hand. A hand is good if the sum of its elements is a multiple of $5$. We are told to determine the number $N$ of good hands.

Each hand $H$ determines a quintuple $x=(x_0,\ldots, x_4)$ of numbers $x_i\geq0$ as follows:$$x_i:=\#\bigl\{k\in H\bigm| k=i \ ({\rm mod}\ 5)\bigr\}\qquad(0\leq i\leq 4)\ .$$ This means that $x_i$ gives the number of elements in $H$ having remainder $i$ modulo $5$. Whether $H$ is good is completely determined by the $x_i\>$: We must have
$$\sum_{i=0}^4 x_i=5\qquad\wedge\qquad x_1+2x_2+3x_3+4x_4=0\quad({\rm mod}\ 5)\ .\tag{1}$$ A quintuple $x$ satisfying $(1)$ is admissible. Since for each $i\in[0..4]$ there are $100$ numbers in $[500]$ having remainder $i$ modulo $5$, an admissible $x$ represents $$N_x=\prod\nolimits_{x_i\ne0}{100\choose x_i}\tag{2}$$ good hands. This shows that the actually occurring numbers $x_i$ play a role in our problem. Therefore we group the quintuples $x$ according to these numbers. This means that we consider each $x$ as a partition of $5$ into $5$ parts $\geq0$ (by writing the entries of $x$ in descending order), and collect the $x$s belonging to the same partition into a group. There are the following partitions of $5$: $$\eqalign{(5,0,&0,0,0),\quad(4,1,0,0,0),\quad (3,2,0,0,0),\quad (3,1,1,0,0),\cr &(2,2,1,0,0),\quad (2,1,1,1,0),\quad (1,1,1,1,1)\ .\cr}\tag{3}$$ We have to count the admissible quintuples $x$ in each of the groups belonging to the partitions $(3)$. Denote by $a_5$, $a_{41}$, $\ldots$, $a_{11111}$ the resulting numbers of admissible quintuples. As we shall see we have $$a_5=5, \quad a_{41}=a_{32}=a_{2111}=0, \quad a_{311}=a_{221}=10, \quad a_{11111}=1\ .\tag{4}$$ From $(2)$ it then follows that the number $N$ requested in the problem is given by $$\eqalign{N&=5{100\choose5}+10{100\choose3}{100\choose1}^2+10{100\choose2}^2{100\choose1}+{100\choose1}^5\cr &=51\,048\,937\,600\ .\cr}$$ For the proof of $(4)$ it helps to note that when $x=(x_0,x_1,x_2,x_3,x_4)$ is admissible (resp., inadmissible) then the rotated quintuple $x'=(x_4,x_0,x_1,x_2,x_3)$ is admissible (inadmissible) as well.

The facts $a_5=5$ and $a_{11111}=1$ are obvious. For $a_{41}$ we may assume $x_0=4$ and then see that we cannot make any other $x_j=1$ without violating $(1)$. Similarly for $a_{32}$. For $a_{2111}$ we may assume $x_0=2$. As $1+2+3+4=0$ mod $5$ we cannot select three of the numbers $1$, $2$, $3$, $4$ and obtain $0$ mod $5$; hence $(1)$ cannot be fulfilled. For $a_{311}$ we may assume $x_0=3$ and then may select $x_1=x_4=1$ or $x_2=x_3=1$ to fulfill $(1)$. Rotating the two quintuples $(3,1,0,0,1)$ and $(3,0,1,1,0)$ gives $10$ possibilities. Similarly for $a_{221}$.

0

You are free to select any four numbers. It is not clear if the same number can be selected twice. But we get

$499 \cdot 498 \cdot 497 \cdot 496$ different sets of four numbers. It then suffices to add a number that makes this a multiple of five.

The fifth number, if any will do, would be variously $99$ if the sum is already a multiple of 5, and $100$ if it is not.

It then comes that for each possible final position, it would be excluded 1, 2, 3, or 4 times as it agrees modulo 1,2,3,4 with the previous sets. It then is a matter of running through the possibilities, supposing the first chosen is 1.