The Number 1234 (4 digit numbers)

Question: How many ways can I arrange the digits of the number 1234 so that each permutation has at least three digits are in (i) ascending order and (ii) consecutive positions?

For example, desired permutations are 1234, 2134, and 4123.

Calculation:

The requirements that three digits are in ascending and consecutive order are be satisfied if the permutation contains any of the following: 123, 124, 134, and 234.

Treat the mentioned permutations as one object and the remaining number as one. Three slots has the group 123, 124, 134, and 234. The corresponding last digit for each of the group is 4, 3, 2, and 1, respectively. The number of arrangements so far is 4 * 2 = 8. We are not done though. Here are the eight arrangements calculated:

**123**4

**124**3

**134**2

**234**1

4

**123**

3

**124**

2

**134**

1

**234**

Note that 1234 appears twice. Let's remove the duplicate. We are left with 4 * 2 - 1 = 7. A table of all possible arrangements of 1234 (with the desired permutations highlighted).

The Number 12345 (5 Digits)

Let's address the same question, this time with the arranging the digits of 12345.

Calculation:

The requirements that three digits are in ascending and consecutive order are be satisfied if the permutation contains any of the following: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345. There are 10 three-digit combinations.

Like before, treat the three digit combinations as "one object" and the two remaining digits separately. For example, the combo 124 will fill three digits, 3 and 5 will complete the other two digits. The gross number of permutations are (10 * 3) * 2 * 1 = 60. Like the last problem, we have to account for duplicates. In those 60 permutations counted, 12345, 12354, 12453, 13452, 23451, 21345, 51234, 41235, 31245 are counted twice, and 12345 counted thrice. Removing 10 duplicate permutations, we arrive at our final answer: 60 - 10 = 50.

The complete calculation is: (10 * 3) * 2 * 1 - 10 = 50.

A table of all possible arrangements of 12345 (with the desired permutations highlighted) is shown below:

I am not 100% sure if there was a formula for answering this question - but here is a way to find such arrangements using brute force. What inspired me to do pursue this question was this video published by Numberphile:

https://www.youtube.com/watch?v=CwIAfkuXc5A

In this video, Simon Pampena arranges nine numbered cards and addressed how often those cards are arranged with at least four cards are in ascending or descending order. However, Pampena does not the requirement that the ordered cards are arranged in consecutive slots.

BTW, I am back from Seattle in Southern California.

Have a great weekend - the rest of it - and I'll talk to you next time!

Eddie