# Four is cosmic

Try to spot the pattern in the following sequence. 2 is 3, 3 is 5, 5 is 4, 4 is cosmic. Not sure? We can start with any number you like. For example, 100 is 10, 10 is 3, 3 is 5, 5 is 4, 4 is cosmic. This was one of my favourite never-can-tell games to play at summer camp, both when I was a camper trying to figure it out and when I later became a counsellor. A never-can-tell game is a riddle that works in such a way that a player can prove that he has the solution without giving away the trick. For example, a camper might claim to have solved the “Four is cosmic” game, and she can prove it by simply reciting the sequence for a new arbitrary number that we give her. In this article we’re going to investigate some the properties of the sequences generated by this game — so beware, spoilers ahead!

### The riddle

The first thing you’ll notice is that every sequence ends in 4. Instead of ending the sequence with “4 is cosmic”, we could instead say “4 is 4, 4 is 4, 4 is 4,…” on and on forever. This is usually the hint that helps kids get the riddle. If you didn’t get it yet, I’ll let the cat out of the bag. For every number in the sequence, we obtain the next one by counting the number of letters in its name. The number 4 is unique because it is the only number whose value matches the number of letters in its name. If, for all natural numbers $n$, we define the function $S(n)$ to be the number of letters in the English spelling of $n$, then $n=4$ is a fixed point of the function because $S(n) = n$. For the purposes of the game (at least the way I play it), we’re not going to count spaces or hyphens, nor do we add “and” between certain parts of a number, i.e. $S(123)=21$ (count the letters in “one hundred twenty-three”, not “one hundred and twenty-three”). Tweaking these rules would give slightly different sequences, but the difference of a couple letters here and there wouldn’t affect the properties we’re examining in this article. Also, we’re going to disregard 0 and negative numbers, because, after the first entry, their sequences contain only natural numbers anyway.

In any case, for any natural number $k$ can now let $COSMIC(k)$ define the sequence given by

$COSMIC(k)_1 = k\\ COSMIC(k)_n = COSMIC(k)_{n-1}, \ \text{for any}\ n>1$

For example, $COSMIC(12)=12,6,3,5,4,4,4,4,\ldots$ and $COSMIC(9)=9,4,4,4,4,\ldots$.

### Proof of convergence

It’s pretty evident that the sequence will always converge to 4, but let’s take a moment to investigate this just to make sure. After all, how can we feel safe playing this game with children if there’s a possibility that they’ll be stuck saying numbers forever? Thankfully this is not too hard to reason about. First we check that $COSMIC(k)$ converges to 4 for all $k = 1,\ldots,19$. In particular, no sequence has a cycle. So once the sequence of any given number falls in this range, it will have no choice but to converge to 4.

Then we need to show that all sequences that start above 19 will decrease to this range. Concretely, we can do this by showing that $S(k) < k$ for all $k \geq 20$. First, the numbers that have unique names, such as 20 through 90 as well as 100, 1000, 1000000, etc. have less letters than their value. Dealing with compound forms is not so hard either. For double-digit numbers, we just need to add the number of letters in the tens place and the number of letters in the ones place. So for example, $S(23) = S(20) + S(3) = 6 + 5 = 11$. And for larger numbers, we add place values in a similar fashion:

\begin{align*}\\ S(35895) &= S(35000) + S(895)\\ &= S(35) + S(1000) + S(800) + S(95)\\ &= S(30) + S(5) + S(1000) + S(8) + S(100) + (90) + S(5)\\ &= 6 + 4 + 8 + 5 + 7 + 6 + 4\\ &= 40 \end{align*}

This is just an overly complicated way of expressing the process all of us do whenever we read out a large number. Because each large number can be broken up into atomic parts and we know that each atom causes the sequence to decrease, we know that the sequence for any large number will eventually fall into the range $1,\ldots,19$. Thus every sequence converges to 4.

### Lengths of sequences

Since every sequence eventually hits 4, we can just stop writing its elements when we hit 4. So we can write $COSMIC(8)$ as $8,5,4$ and $COSMIC(4)$ is just $4$. The remaining infinity of 4s is implied. I wrote a program to generate cosmic sequences and this is what it spat out for $k = 1,\ldots,500$. You’ll notice that none of them are very long. This begs the question. How long can sequences get? Maybe we can’t be stuck saying numbers forever, but that’s no comfort if it takes more than a lifetime to recite a certain sequence. Here we need not worry either. I tweaked the program to measure the cosmic sequences for all numbers up to 999,999,999 and surprisingly, no sequence has length greater than 7!

$time ./a.out 999999999 323 has the longest sequence (7 elements). real 2m27.876s user 2m26.398s sys 0m1.338s  In fact, many sequences are tied for this prize, but, assuming my program is correct, the smallest value whose sequence has length 7 is$COSMIC(323)=323,23,11,6,3,5,4. Here are the minimum values that attain sequences of each length: \begin{align*} COSMIC(4) &= 4\\ COSMIC(5) &= 5,4\\ COSMIC(3) &= 3,5,4\\ COSMIC(1) &= 1,3,5,4\\ COSMIC(11) &= 11,6,3,5,4\\ COSMIC(23) &= 23,11,6,3,5,4\\ COSMIC(323) &= 323,23,11,6,3,5,4 \end{align*} If we wanted to cook up a sequence that had eight elements, we would need to find a number that had exactly 323 (327,328,,333, etc. also work) letters in its name. This number would be pretty large. To find out exactly how large, we start with the observation that the number with the most letters in the range 1,…999,999,999 is 373,373,373, with 87 letters.  time ./a.out 999999999
373373373 has the most letters (87 letters).
real	1m49.890s
user	1m48.248s
sys	0m1.438s


Every time we add three digits, we can maximise the number of letters we add by using the numerals 373. This adds 24 letters, plus however many letters make up the place value (billion, trillion, quadrillion, etc.). Let’s estimate this value at $23+10=34$. Then every time you add 34 letters, you’re multiplying the number by some factor of 1000 (because you’re adding three digits). With 9 digits we can reach 87 letters and we have to add 34 roughly 7 times to get to 323. So the smallest $k$ for which $COSMIC(k) = 8$ has $9 + 7(3) = 30$ digits — the order of a nonillion. This is a pretty large number. Let’s call it $VAL8$ for short, because I don’t know its exact value. With 30 digits, it still fits on a single line of a page and you could read it out in a few seconds.

But how about $VAL9$, the smallest value with 9 elements in its cosmic sequence? It would have to have $VAL8$ digits, meaning that it would take roughly $3.33\times 10^{26}$ pages to write it out, assuming 3000 digits per page. And if you had to read it out quickly (suppose it takes one second to read a block of three digits), it would take about $3.17\times 10^{19}$ years. To put that in perspective, the universe is only about $1.37\times 10^{10}$ years old. So we have to amend the claim of the last section. No one can force you to say a sequence that has more than 8 elements (i.e. make you say numbers forever) without themselves taking longer than the age of the universe to tell you what number to start at!

### Quatre n’est pas cosmique

As a brief sidenote, properties of cosmic sequences are quite different in different languages. For example, in French, not only is the number 4 (“quatre”) not cosmic, no number is cosmic! You can try a few starting values to see this for yourself. For example, for $k=1998$ (“mille neuf-cent quatre-vingt-dix-huit”) we have:

$COSMIQUE(1998) = 1998,31,10,3,5,4,6,3,5,4,6,\ldots$

I haven’t played around too much with cosmic sequences in French, but it seems to me that every sequence eventually falls into the cycle $(3, 5,4,6)$. There are other issues with the French counting system that make recursively adding lengths difficult a bit more complicated, but I’m relatively sure this cycle will always happen, for the same reasons as stated in the proof of convergence before.

### Wrapping up

A couple of interesting sequences arise from the study of the “Four is cosmic game”. First, each number has its own $COSMIC$ sequence. We also saw that the length of any reasonable number’s cosmic sequence is less than 8. Indeed, here is a wonderful picture of the lengths of cosmic sequences, starting at the length of $COSMIC(1)$. They range from 1 to 7.

And lastly, we found that there is a sequence of smallest starting values for a given sequence length:

$4,5,3,1,11,23,323,VAL8,VAL9,\ldots$

If anyone finds out the exact value of what I’m calling $VAL8$, it’d be really awesome if you could contact me via one of the buttons on the sidebar so I can add it to the article and complete the (writable) collection of $VAL$s.

At the very least, I hope this article taught you a new game to annoy your friends with and, if you already knew the game before, gives you the confidence to play the “Four is cosmic” game without the worry that it might be the last thing you do.