First of all, this may seem very basic for you, but I've never been good at math, and I can't figure this out!

I need to solve the number of sequences that exist under this conditions:

  • All sequences are made of four numbers like 0123
  • All the numbers must be different
  • The first and the last number are on the same horizontal line
  • The second and third numbers are on the horizontal line immediately above the first and last number line

This is table that is provided with the problem


How many sequences exist under these conditions?

a) 72

b) 90

c) 162

d) 171

  • $\begingroup$ For example, $4236$ would be allowed since all the numbers are different, $4$ and $6$ come from the second row and $2$ and $3$ come from the row above. Correct? $\endgroup$ – Michael Burr Feb 11 at 10:51
  • $\begingroup$ Yes! That is one allowed sequence! $\endgroup$ – Andrej Hatzi Feb 11 at 10:55
  • $\begingroup$ I might not have understood the problem statement correctly, but this is how I see the problem. The first and fourth digits can only be chosen from lines 2 and 3 since there is only one digit in the last line and there is obviously no line above the first line. We can choose a digit from the second line in 3 ways, then choose an item from the first line in 3 ways, then another one from this line in 2 ways and finally we have 2 options for the last digit. Multiplication yields 36 options. Then we have 72 more options if the 1st and 4th digits are chosen from the third line. $\endgroup$ – Don Draper Feb 11 at 10:57
  • $\begingroup$ @DonDraper: do you mean $36+72$ ? $\endgroup$ – Yves Daoust Feb 11 at 10:59
  • $\begingroup$ @YvesDaoust, yes, but it seems that this is wrong. $\endgroup$ – Don Draper Feb 11 at 11:00

As two pairs of different digits must be on the same row, $0$ is excluded.

You can choose the first and last digits freely in the second or third row, which makes $2\cdot3\cdot2$ options, then the second/third digits in the first or second row respectively.

In total,


  • $\begingroup$ Thank you, but can you explain it further? I am really bad at math! How did you arrived into this expression 2⋅3⋅2 ? $\endgroup$ – Andrej Hatzi Feb 11 at 11:05
  • $\begingroup$ @AndrejHatzi: try to enumerate the solutions in a systematic way. $\endgroup$ – Yves Daoust Feb 11 at 11:08
  • 1
    $\begingroup$ After 2 minutes of thinking about your explanation I could understand it! Thank you very much for your guidance! $\endgroup$ – Andrej Hatzi Feb 11 at 11:12
  • $\begingroup$ @AndrejHatzi: I preferred to let you think rather than giving a straight answer. $\endgroup$ – Yves Daoust Feb 11 at 11:22

You shall only choose the first and last digit from the two middle rows. That's because the bottom row contains only one number and for the top row, there's no row above to choose the second and third digit.

Let's start by choosing two digits from the $3$rd row. We can choose and rearrange two items out of three in $$P(3,2)=\frac{3!}{1!}=6$$ ways. Following the exact same reasoning, for the second and third digit, we have: $$ P(3,2)=\frac{3!}{1!}=6 $$ ways for the middle digits.

Thus, $6$ ways to choose first and last digits and $6$ ways to choose second and third. That's a total of $36$ ways to choose all $4$ digits.

Also, we could repeat all these actions, choosing the first and last from the $2$nd row and the middle ones from the $1$st one. Again, that's a total of $36$ ways to choose all four digits.

At last, since we can carry out this procedure either the first $36$ ways or the other $36$ ways, the total ways are $$ 36+36=72. $$


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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