# Thread: Hard combinatorics problem

1. ## Hard combinatorics problem

In how many ways can the elements of [n] be permuted if 1 is to precede 2 and 3 is to precede 4?

[n] is the set of integers from 1 to n.

2. ## Re: Hard combinatorics problem

Thinking...

The problem is meaningful only for n >= 4.
For n = 4, there are 6 possible permutations: (1, 2, 3, 4), (1, 3, 2, 4), (1, 3, 4, 2), (3, 4, 1, 2), (3, 1, 4, 2) and (3, 1, 2, 4).
For n = 5, '5' can go into any of the five 'gaps'. There are 5*6 = 30 possible permutations.

The numbers greater than 4 will have to placed into some or all of the five 'gaps'.

3. ## Re: Hard combinatorics problem

(Not entirely my own.)

The problem is meaningful only for n >= 4.
When n = 4, there are 6 possible permutations: (1, 2, 3, 4), (1, 3, 2, 4), (1, 3, 4, 2), (3, 4, 1, 2), (3, 1, 4, 2) and (3, 1, 2, 4).
When n = 5, '5' can go into any of the five 'gaps' of n = 4. There are 5*6 = 30 possible permutations.
When n = 6, '6' can go into any of the six 'gaps' of n = 5. There are 6*30 = 180 possible permutations.
... and so on.
So, for n > 4, there are n(n-1)...5 * 6 possible permutations. We rewrite 6 as 4!/4.
So, the number of possible permutations is n(n-1)...5*4!/4 = n!/4.