Find the maximum number of elements in the set $M$ such that no two elements have a difference of $5$ or $8$

494 Views Asked by At

$\textbf{Question :}$ Let $M$ be a set of positive integers less than or equal to $2000$ with the property that no two elements can have a difference of either $5$ or $8$ then what is the maximum number of elements in $M$?

$\textbf{My Attempt :}$

Choosing the the numbers as following $(1,2,3,4,5); (14,15,16,17,18); ...; (1990,1991,1992,1993,1994)$ we get a total of $770$ numbers but this is way off the given answer which is $924$.

1

There are 1 best solutions below

0
On BEST ANSWER

You've got the right general idea. However, first include $8$ (since subtracting $8$ gives $0$) then, starting from $1$, include every integer after which doesn't already have one which is different by $5$ or $8$. We end up with $M$ being all of the integers which, when divided by $5 + 8 = 13$, have a remainder in

$$\{1, 2, 4, 5, 8, 11\} \tag{1}\label{eq1A}$$

To verify this, consider each result after adding or subtracting $5$ and $8$ modulo $13$. For $1$, adding $5$ and $8$ gives $6$ and $9$, respectively, while subtracting $5$ gives $-4$, which is equivalent to $13-4=9$, and subtracting $8$ gives $-7$, which is equivalent to $13-7=6$, i.e., the same two as when adding (e.g., since adding $5$ is the same as subtracting $8$ modulo $13$). Doing this for all of the values in \eqref{eq1A} gives the remainders to exclude to be

$$\begin{equation}\begin{aligned} 1 &: 6, 9, 9, 6 \\ 2 &: 7, 10, 10, 7 \\ 4 &: 9, 12, 12, 9 \\ 5 &: 10, 0, 0, 10 \\ 8 &: 0, 3, 3, 0 \\ 11 &: 3, 6, 6, 3 \end{aligned}\end{equation}\tag{2}\label{eq2A}$$

Thus, none of the values to exclude overlap with any of the values in \eqref{eq1A}. This confirms we can use $6$ values out of every full set of $13$ integers. Note each remainder can appear only up to $4$ times on the right side (due to $\pm 5$ and $\pm 8$) so, for using $6$ remainders, there must be at least $6$ ones to exclude (actually, all $7$ are in \eqref{eq2A}, with $7$ and $12$ each only appearing twice). Thus, using $7$ or more remainders instead isn't possible since it'd require at least $7$ to be excluded, but there's only $13$ in total available.

Since $2000 = 153 \times 13 + 11$, we can get one more full set of $6$ integers out of the $11$ remainder, so the number of integers in $M$ is

$$154 \times 6 = 924 \tag{3}\label{eq3A}$$

Analytically proving \eqref{eq3A} is the maximum possible involves something like showing that using $7$ or more values within any group of $13$ means at least those extra number of values must then be excluded before and/or after the group. Since the proof would be fairly long and messy, I'm not including it here.