Find the number of ways to choose a pair $\{a,b\}$ of distinct numbers from the set $\{1,2,...,50\}$ such that

i) $|a-b| = 5$;

ii) $|a-b| \leq 5 $

My thoughts:

For (i) For every 6 consecutive numbers, there's a pair. But I can't do $C_{6}^{50}$ as it's not every 6 number combinations I want.

Then answer given is (i)45 (ii)235


4 Answers 4


For the first problem, the leftmost (smallest) of the chosen numbers can be any of $1,2,3,\dots,45$. Then the other number is determined.

A similar idea will take care of the second problem. The number of choices is $49+48+47+46+45$.

The same idea works in general. For the generalization of the second problem, we are summing a simple arithmetic sequence.

  • $\begingroup$ I don't understand how to solve the second problem. Why do we have to sum up? Thanks! $\endgroup$ Sep 29, 2014 at 18:32
  • 1
    $\begingroup$ If the difference is $1$, the leftmost can be chosen in $49$ ways. If the difference is $2$, the leftmost can be chosen in $48$ ways, and so on to $45$ ways. Absolute value of difference $\le 5$ breaks down into $5$ cases, absolute value is $1$, absolute value is $2$, is $3$, is $4$, is $5$. $\endgroup$ Sep 29, 2014 at 18:35
  • $\begingroup$ I'm wondering why $45 \times n_{2}^{6}$ doesn't give the same answer? $\endgroup$ Sep 29, 2014 at 19:57
  • 1
    $\begingroup$ I see no reason that it should, since I do not see $45\times \binom{6}{2}$ as counting what we want to count. $\endgroup$ Sep 29, 2014 at 20:09

For the first one Consider number (1, 6) and (2,7) .....(45, 50) there are 45 ways

For the second one consider the number 1 and 6 again and the number between them. If we select any two numbers from these the difference is less than 5 and the number of ways we can select any two numbers from these is C(6, 2). We have more numbers

2, 3, 4, 5, 6, 7

Now here since we have already chosen combinations with the numbers 2, 3, 4, 5, 6 we have to choose combinations with the number 7 so choosing these pair's with 7 is 5 ways. Now considering the same argument with other numbers gives the total number of ways is equal to C(6, 2)+44*5=235

  • $\begingroup$ Sorry, just realized the answer to the second question is wrong. The answer is supposed to be 235. $\endgroup$ Sep 29, 2014 at 18:30
  • $\begingroup$ Edited the answer @Delvacode .... $\endgroup$
    – Jasser
    Sep 30, 2014 at 4:50

For i) it's all the integers that lie on the lines $y=x+5$ and $y=x-5$ in the square $[1,50]^2$. These are symmetric so you need only count one of them and multiply by 2.

$$2\sum_{x=1}^{45} 1 = 90$$

For ii) You can count all that above or on $y=x+5$ as $x$ moves from 1 to 45, multiply by 2, and subtract from 2500.



For the second problem, you can consider the two cases where the smaller number a satisfies

1) $1\le a\le 45$ and 2) $46\le a\le 49$.

The first case gives $45\times5$ possibilities, and the second case gives $4+3+2+1=10$ possibilities, for a total of 235 choices.

Alternatively, you can let $x_1,x_2,x_3$ be the number of integers in the 3 gaps created by a and b.

Then $x_1+x_2+x_3=48$ where $x_1\ge0, \;0\le x_2\le 4, \;x_3\ge0$;

so the number of solutions is given by $\binom{50}{2}-\binom{45}{2}=235.$

(I am assuming the pairs are unordered.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.