My son had a really interesting problem as part of the homework for an enrichment math program he’s in. I’m writing this post from the road so I don’t have the exact statement of the problem in front of me, but it went something like this:

You are going to make 7 digit numbers using the digits 1, 2, 3, . . . , 7 exactly once. How many of these numbers have no consecutive digits with common divisors?

So, for example 1,234,567 is a perfectly fine number, but 2,413,567 doesn’t work.

My son’s solution was nice, but complicated. He found the number of ways to separate the even numbers (there are 10) and then found the ways to fill in the odd numbers in each of those cases.

I couldn’t find an easier solution and wondered on Twitter if there was one. One response I got pointed me to a similar problem that was discussed on the Art of Problem Solving problem forum:

Looking through the thread I stumbled on a really clever inclusion / exclusion solution. Since we’ve been taking a closer look at inclusion / exclusion ideas I thought it would be fun to step through this solution with the boys. I think this a really instructive inclusion / exclusion example. One thing that was a little tough for the boys to understand was that the elements we were “excluding” were pairs of integers.

Also, just to be clear, I’m not expecting the boys to have a complete understanding of this solution. Rather, I just wanted to show them an inclusion / exclusion example that had some interesting twists.

So, we started by introducing the problem because my younger son hadn’t seen it before:

Next we dove in to the inclusion / exclusion solution. The “no restrictions” case is easy! Seeing the way to express the restrictions is pretty challenging. Once we understood that case we looked at subtracting away the cases with 1 restriction.

Next we looked at the 2 restriction case. Now things get really tricky – the fact that we have now have pairs of pairs of numbers is one bit of confusion. Another bit of confusion comes because one pair of pairs is not like the others.

Finally we looked at the case with 3 restrictions. This part, I think anyway, is really cool. The surprise is that several of the cases are impossible!

Despite being a very challenging problem, I love this problem as an inclusion / exclusion example for kids. No individual piece is beyond their reach and if you walk through the problem slowly everything is accessible to them.