*This post originally appeared on scientificamerican.com.*

The word “factoradic” jumped out to me when I peeked over a new math friend’s shoulder and saw it in the title of the paper she was revising. What a great word! I had no idea what it meant.

My new friend showed me with an example: the number 2019 is 2(6!)+4(5!)+4(4!)+2!+1. Or more formally, it’s 2(6!)+4(5!)+4(4!)+0(3!)+1(2!)+1(1!)+0(0!). (That last term is a little silly, but we’ll want it later.) Whew, that’s a lot of digits and punctuation marks! The exclamation point is of course the factorial symbol, not an expression of excitement about numbers. For a positive integer *n*, *n!* is the product of the integers 1 through *n*.

To write a number factoradically (or in the factorial number system, as some people call it), you express it as the sum of multiples of factorials with the rule that you can’t use a coefficient larger than *n* for the *n!* term. That is, you are not allowed to write the number 6 as 3(2!). You’d have to write it as 1(3!) or just 3!.

The restriction is similar to the restriction we have when we write numbers in base two or base ten that we only use digits less than the base. Base two uses the digits 0 and 1. Base ten uses 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. There’s a good reason for that restriction. With it, every positive whole number has a unique factorial representation, just like it has a unique representation in base two or base ten.

If a number is written in a base other than ten, the base is often indicated as a subscript. So the number 212_{3} means the number 212 in base three, which is 2(3^{2})+1(3)+2=23_{10}. (I have objections to the notation—putting a base ten number as a subscript to indicate a different base shows that you have no faith in your product—but my readers deserve to know the truth about how people write this.) Likewise, the subscript ! indicates that a number is written factoradically. Hence, 2019_{10}=2440110_{!}.

It’s fun to prove to yourself that there is only one way to represent a given positive integer in the factoradic system. But once you’ve done that, a big question remains: Why? What does factoradic do that you can’t get with binary, decimal, sexagesimal, or any of the other infinitely many other number bases you could choose instead?

My first guess was that factoradic would be more efficient when writing larger numbers. I noticed that unlike the binary or decimal system, where each new place in the place value system has a constant multiplicative relationship to the place before, with factoradic, each new place is more bigger than the place before was than the place before it. (That sentence is convoluted, but I’m leaving it in because I love a legitimate use of the phrase “more bigger.”) In other words, the ratio between the value of each place is not a constant, as it is in usual number bases. It grows.

The rightmost place is the ones place, the next place to the left is twice as big, the place to the left of that is three times as big as the twos place, and so on. That means factoradic gets more efficient as we start looking at larger numbers. The number 2019_{10} takes longer to write factoradically than in base ten, but if you want to write numbers that are much larger than 20!, factoradic will start to use fewer digits. (Figuring out how to write those extra digits is left as an exercise for the reader.)

But digit efficiency isn’t the real reason factoradic exists. As far as I can tell, no one is breathing a sigh of relief that they can write numbers with 40 decimal digits using only 34 factoradic digits. One application of factoradic is the all-important task of impressing your friends with a card trick. Read Tom Edgar’s article about that in Math Horizons. But factoradic is also useful for describing permutations.

A permutation of *n* things is a way of ordering them. You can also think of it as a word with *n* different letters. There are n! permutations of *n* things, and factoradic provides a fairly simple way to associate each number between 0 and *n−1* with one of the permutations of *n* objects.

Now we can figure out what permutation of the numbers 0 to 6 we should associate with the number 2019_{10}, using its factoradic representation, 2440110_{!}.

Let’s imagine we line up the digits 0 to 6 in a nice ordered row, {0,1,2,3,4,5,6}. The first digit of 2440110 is 2, which tells us we want to count “0-1-2” and choose the corresponding number, 2, as our first number. We take the 2 out of our row, leaving {0,1,3,4,5,6}. The first 4 in 2440110 tells to count 0-1-2-3-4 and take the corresponding number. Because we had already removed 2, we get 5. Now we do the same thing again for the next 4, adding 6 to our permutation. We now have {0,1,3,4}. The digit 0 corresponds to 0, and we have {1,3,4}. Then the 1tells us to count 0-1 and pull out the 3, the next one gives us 4, and finally the last number left is 1. In the end, the number 2019 gives us the permutation 2,5,6,0,3,4,1.

If that was a little tricky to follow in words, I recommend taking a look at the lovely explanatory diagram on the Wikipedia page and then try a few yourself. Starting to count at 0 instead of 1 is a bit of a stumbling block, but it really is a sensible choice. (I tried starting at 1 instead, and it made things more complicated because it was hard to deal with the digit 0.)

This use of factoradic is called the Lehmer code. It is one way to think about a problem this Numberphile video described as how to choose a toilet at a music festival. With that lovely thought, I’ll leave you to enjoy your new factoradical toy!

## Recent Comments