I’ve just posted my latest YouTube video, in which I explain how to use binary numbers to jazz up your nail varnish:

Alongside this video, I also have an associated puzzle for you to think about.

At the very end of the video, there’s a clip showing my hand with every possible combination of varnish from 0 to 31 – shown in this gif:

The puzzle is:

Suppose I want to paint my nails on one hand differently every day for a month – so I need to use all 31 combinations involving glitter. Assuming that a nail painted with plain varnish can have glitter added, but a nail with glitter needs to be nail-varnish-removed before it can become a plain nail again, what order do I apply the different combinations so that you minimise the amount of nail varnish remover I’ll need to use?

For example, you could paint on 1 (00001) for the first day, then quite easily change it to a 3 (00011) for day 2 by glittering one nail, but to do 2 (00010) would require removing glitter. In taking the photos to make the video clip, I came up with a quick ordering on the back of an envelope, which did save me some time and effort from doing it in number order, but I’m pretty sure it’s not optimal. Can you find a better one?

We’ll be posting the answer, with the interesting maths behind all this, in the next week or so. In the meantime, no spoilers in the comments (here or on the video!)

A word: gray code. To go through 31 days (30 transitions from one coloring to another) should take 15 transitions in the “add glitter to one nail” direction and 15 transitions in the reverse. You could probably do 31 transitions with 16 adds and 15 subtracts, say if you wanted to count the transition to the initial painted state as a first transition.

[Have not seen your answer, but I am pretty sure that gray code is the solution. On the 1968 Putnam (yeah, I was ranked – far enough down I would call it “also ran” status) I was happy to have solved the problem that, effectively, involved reinventing gray code.]

Looks like a good video for getting girls involved in mathematics. And a nice cameo appearance by the late, great Claude Shannon, the father of Information Theory.

Thanks for the nice comment! Gray code, it turns out, is not the answer in this case. An explanation to why, and the solution we got to, is here: http://aperiodical.com/2016/06/binarynail-varnish-puzzle-solution/