# Blog

**2021-01-03**

## Christmas (2020) is over

Showing all comments about the post Christmas (2020) is over. To return to the blog post, click here.

### Comments

Comments in green were written by me. Comments in blue were not written by me.

You can solve the Dec 21 puzzle using the principle of inclusion/exclusion:

-There are 6! total ways of arranging 6 numbers.

-Now we have to exclude the ones that don't fit. How many ways have 2 following 1? You can think of 12 as a pair, so you're arranging 12/3/4/5/6 in any order, so there are 5! ways to do this. And there are (5 choose 1)=5 total pairs that might exist, so there are 5*5! ways that have either 12, 23, 34, 45, or 56.

-Of course, we've double counted some that have more than one pair. (This is where inclusion/exclusion comes in, we have to include them back in). So how many have, say, 12 and 45? Well now we're arranging 12/3/45/6, so there are 4! ways to do so. There are (5 choose 2)=10 different pairs, so the double counting was 10*4!.

-We continue this on, and inclusion/exclusion says we keep alternating adding and subtracting as we add more pairs, so the answer is:

6!

- (5 choose 1) * 5!

+ (5 choose 2) * 4!

- (5 choose 3) * 3!

+ (5 choose 4) * 2!

- (5 choose 5) * 1!

= 309

-There are 6! total ways of arranging 6 numbers.

-Now we have to exclude the ones that don't fit. How many ways have 2 following 1? You can think of 12 as a pair, so you're arranging 12/3/4/5/6 in any order, so there are 5! ways to do this. And there are (5 choose 1)=5 total pairs that might exist, so there are 5*5! ways that have either 12, 23, 34, 45, or 56.

-Of course, we've double counted some that have more than one pair. (This is where inclusion/exclusion comes in, we have to include them back in). So how many have, say, 12 and 45? Well now we're arranging 12/3/45/6, so there are 4! ways to do so. There are (5 choose 2)=10 different pairs, so the double counting was 10*4!.

-We continue this on, and inclusion/exclusion says we keep alternating adding and subtracting as we add more pairs, so the answer is:

6!

- (5 choose 1) * 5!

+ (5 choose 2) * 4!

- (5 choose 3) * 3!

+ (5 choose 4) * 2!

- (5 choose 5) * 1!

= 309

Todd

**Add a Comment**

2021-01-06The 16th was just cheeky, after I spent way to much time on the 15th it was nice to have something like that!

It's been 16+ years since I did any probability or combinations and permutations, so it was nice to brush off that part of my brain, not that I did any of them well, but it should serve me well when my kids start doing them and ask me for help.