Notice the date: 06/21/2016. If we rearrange the digits in year, 2016 we obtain 0621 as one of the other 23 possible rearrangements. Now, 0621 is not how we write numbers since we leave off the leading zero. However, if we permit ourselves to write insert a forward slash (/) then we can construct a valid date — 06/21.
So, how many valid dates can we create from 2016?
To tackle this problem we visit a friendly subject area called “Combinatorics”. Combinatorics deals specifically with counting and goes beyond what many students learn in the K-12 math curriculum and quite possibly even in college.
Date mangling is a fun way to get students to begin exploring the world of counting. For a first introductory exercise ask students to construct all rearrangements of 2016. They should find that in addition to 2016, there are 23 other ways to do this. This becomes an easy set up for “why?”. Most students can be convinced that since there are four positions and each digit can only be used once, there are \(4\times 3\times 2\times 1 = 24\) ways to rearrange 2016. This allows for a natural introduction to the factorial symbol \(!\) and the word permutation.
So, we come back to our problem of how many valid dates can we create from 2016?
There are several ways to answer this. If we have already written out the 24 possible permutations, then it is simply a matter of inserting a forward slash so that we have dates of the form xx/xx and seeing which of those are valid.
On the other hand, we can try to see if we can do this with a little extra grouping. Why write out everything if we can do this with less direct counting?
So, let’s start this off recognizing that our date format has to be xx / xx and for the purposes of this exercise we will restrict ourselves to American style dates where it is MM / DD.
If we want to fill in valid dates, we have to understand the restrictions that exist. In the MM / DD format, the first M can be no larger than 1. Thus, all rearrangement that start off as 2M / DD or 6M / DD are not permissible. This immediately reduces our set of possibilities down to 12 from the original 24. Huzzah! Mathematicians would say that “we’ve narrowed our sample space”.
Next, let’s look at all dates that begin with 0M / DD. There are a total of six rearrangements involving the remaining three digits, 1, 2, and 6. So how many valid dates are possible? We know we can’t have dates that look like 0M / 6D, but everything else is possible. Disallowing 0M / 6D takes away two more permutations. So we’re down to 10 from the original 24.
Next, we look at 1M / DD dates. Clearly, we can’t have 16 / DD, so that takes away two more cases bringing us to 8. And, once again, we can’t have 1M / 6D, bringing us down another two to 6 remaining possibilities. Since we eliminated 2M / DD and 6M / DD entirely, we know we’re done.
Therefore, the valid dates are
- 01/26 — January 26th
- 02/16 — February 16th
- 06/12 — June 12th which was also a part of the palindrome date stretch when written as 6/12/16!
- 06/21 — Today!
- 10/26 — October 26th, oooh I’ll write some for then
- 12/06 — December 6th
We could have also done this by considering only valid positions and counting up.
Notice, that I wrote the dates in chronological order. This was neither done by chance nor done by first haphazardly writing all the dates and then sorting them. I wrote these dates down in sorted order, naturally. This is counting in a more general way.
If you are curious, I would encourage you to look up “combinadic” and “factoradic” numbering. Also, if you want to just explore more mechanically with a little bit of programming, try fooling around with Python’s itertools
module.
As an aside, “permutations” are to numbers as anagrams are to words. For example, consider the following math-y anagram.
“Medical!”, claimed maliced decimal when the student converted 0.005 to 5% — from the journal of Alice, MD.
For now, enjoy the start of summer (at on this side of the world) and a fun date!