Wednesday 3 July 2019

The Numerologist's Birthday Cake

Everybody loves to blow out candles on their birthday cake. The problem is, once you get past about 10, the cake becomes a serious fire hazard if you stick with tradition and have one candle for each year. Once you become a fully qualified adult, you'd have to be a committed pyromaniac to try. So people make compromises, just one candle, or one per decade for those "important" birthdays.

That's a bit boring though. Being interested in number theory, I came up with another idea: make the number of candles equal to the number of non-distinct prime factors of your age.

"What...???" I hear you thinking. But trust me, it's quite simple really.

Every number can be expressed as a product of prime numbers, if it isn't one itself. To recap: a prime number is one that can't be divided by anything except itself and 1, like 2, 3, 5, 31, 8191, ... and many others in between and beyond. There's a simple and elegant proof that they go on for ever - there is no "largest prime number". Unfortunately there is no room for it in the margin here.

So for numbers which are not prime - called composite numbers - you can multiply prime numbers together to make them. Here are the first few:

     4 = 2 * 2
     6 = 2 * 3
     8 = 2 * 2 * 2
     9 = 3 * 3
    10 = 2 * 5
    12 = 2 * 2 * 3
    14 = 2 * 7
    15 = 3 * 5
    16 = 2 * 2 * 2 * 2
    18 = 2 * 3 * 3

and so on. It's easy to show that for any given number, there is exactly one way to do this. Some more examples:

    99 = 3 * 3 * 11
   255 = 3 * 5 * 17
   256 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2

The important thing, for my birthday cake, is how many numbers you have to multiply together, whether they are the same or not. So for 4, it's 2, for 16, it's 4, for 18, it's 3 and so on. For 256 it would be 8, but it's not very likely to happen.

The nice thing about this is that the number of candles varies with each year, but it never gets too big. What's the largest number of candles you can ever need? Well, 64 is 2*2*2*2*2*2, i.e. 6 candles. The smallest number with any given quantity of candles will always be a power of 2 (i.e. a number where all the factors are 2). The next 6 candle birthday is 96, which there is some chance of making. The next one would be 144, which is pretty improbable.

The first birthday with more than 6 candles would be 128, which is 64*2 and hence needs 7 candles. I don't think it's worth saving up for that seventh candle, really.

Birthdays which correspond to a prime number, like 53, only get one candle. Once you get past 3, there will never be two consecutive one-candle birthdays, since even numbers are always 2 times something. The exception is 2 itself, which is the only even prime number.

Then there are "perfect" birthdays. A perfect number is something rather rare, one where every number that divides it (whether prime or not, and including 1) adds up to the number itself. The smallest is 6:

    6 = 1 * 2 * 3 = 1 + 2 + 3

The next one is 28:

   28 = 1 + 2 + 4 + 7 + 14

After that they get big very quickly: the next two are 496 and 8128. So there are only two perfect birthdays that any of us are likely to see. (All known perfect numbers are even, incidentally. There is a simple formula for finding them. It is one of the great unknowns of number theory whether there are any odd perfect numbers. If so, they are huge: no smaller than 101500. It seems very unlikely, but nobody has managed to prove it either way).

I thought of this because it will soon be my sister's 81st birthday - the first odd birthday with 4 candles (81=3*3*3*3). The next one would be 135 (3*3*3*5), which probably isn't worth waiting for.