Introduction

Here is a little thought I had the other day:

If we got rid of the number 4, what would happen?

Now, I don’t mean that we switch to base 9 and use the symbols 0, 1, 2, 3, 5, 6, 7, 8, 9 for our numbers (though that would be a fun way to confuse people). My disdain for the number 4 runs deeper than this. I want to know what happens when we continue to do math as normal, but we remove all 4’s from existence.

The clearest way of demonstrating what I mean is to look at doubling a number nn. Normally, doubling nn gives us 2n2n. We can write this as n2nn\mapsto 2n if you want to use some more fun math notation.

Definition

What I am proposing, for lack of a better way of writing it, is that doubling nn instead gives us n2n{0,1,2,3,5,6,7,8,9}n\mapsto 2n\cap\{0,1,2,3,5,6,7,8,9\}. In English, you double nn and then cut out all of the resultant fours. For the sake of future shorthand, I will call this doubling function dd.

Here are a few examples to help understand what it means to truly experience freedom from fours fury:

  • d(1)=2d(1)=2: Double 1 to get 2. Nothing new here.
  • d(2)=0d(2)=0: Double 2 to get 4, but we remove the 4 and are left with 0.
  • d(32)=6d(32)=6: Double 32 to get 64, remove the 4 to get 6.
  • d(0)=0d(0)=0. That one is pretty self explanatory.

Notice, by simplying culling fours from our figures, we no longer have a monotonically increasing function! In fact, repeated applications of dd don’t necessarily increase the number.

Chains

Check a few numbers by hand and you’ll find that if you repeatedly apply dd to a number nn, it seems to always collapse to 0, and rather quickly, too. Here is one of my favourite chains produced by a relatively small nn:

  • 19d38d76d152d30d60d120d20d019\xrightarrow{d} 38\xrightarrow{d} 76 \xrightarrow{d} 152 \xrightarrow{d} 30 \xrightarrow{d} 60 \xrightarrow{d} 120 \xrightarrow{d} 20 \xrightarrow{d} 0.

I am using adba\xrightarrow{d}b instead of d(a)=bd(a)=b above to make it easier to read and a bit more visually appealing. We see that 9 collapses to 0 after 8 applications of dd. We can express this as d8(9)=d(d(d(d(d(d(d(d(9))))))))=0d^8(9)=d(d(d(d(d(d(d(d(9))))))))=0. It’s a fair bit cleaner that way.

Let’s also define what a chain is now, even though I’ve already been using it. A chain is a sequence of numbers n,d(n),d2(n),...,dc(n)n,d(n),d^2(n),...,d^c(n) where cc is the first value for which dc(n)=0d^c(n)=0. The chain produced by 19 has length 8, as seen above. The length of the chain can be written as c(n):=min{kN,dk(n)=0}c(n):=\min\{k\in\mathbf{N},d^k(n)=0\}

We can also talk about the longest chain up to a certain number nn, which is the longest chain that can be produced starting at some number 0an0\leq a\leq n.

Here are the chains of the REAL one digit numbers.

DigitChain lengthChain
000
121, 2, 0
212, 0
34 (ew)3, 6, 12, 2, 0
535, 10, 20, 0
636, 12, 2, 0
737, 1, 2, 0
868, 16, 32, 6, 12, 2, 0
969, 18, 36, 72, 1, 2, 0

An aside for art

Let’s do something a bit more visually interesting for a moment and create a graph that shows all of these chains.

A view of the doubling graph of starting numbers up to 19

This is what I call a “doubling graph” of the numbers 0 through 19. It shows the chains for numbers 0 through 19 and how they connect to each other. All of these numbers eventually reach 0.

In fact, the header image at the top of this page is a view of the doubling graph of the numbers 0 through 1000, and they all eventually collapse to 0, too.

Hypothesis

After playing around with this for a while, I have come up with the following conjecture.

Conjecture 1: For all numbers nn, repeated applications of dd will eventually cause it collapse to 0. In otherwords, for each nNn\in \mathbf{N}, there exists some kNk\in\mathbf{N} such that dk(n)=0d^k(n)=0.

This seems to be the case to me because it takes just over 3 doublings to gain a digit (log2(10)3.322\log_2(10)\approx 3.322) but only one unlucky occurrence of a 4 to lose a digit. The only counterexample to this conjecture, aside from some nn exploding to \infty, is if there were some loop where repeated applications of dd looped back around on itself. Essentially, that dk(n)=nd^k(n)=n for some k>1k>1. The odds of this seem to me to be almost just as low as some nn managing to explode.

I checked all numbers up to 100,000,000 with some fairly unoptimized Python code and found that every single one collapsed to 0 eventually. The longest chain in this search that I found was for 99,999,995 with a chain length of 28. The biggest number in this chain is d3(99999995)=1599999920d^3(99999995)=1599999920.

In my exploration, I noticed that the longest chain starting under 10m10^m is usually pretty close to 10m10^m, as seen above with the longest chain I found in my exhaustive search, but with a few key exceptions. Here are the first few powers of 10 and their longest chain.

LimitLongest chainStarting number for longest chain
10110^16688
10210^212129999
10310^312129999
10410^4171799999999
10510^520209999899998
10610^62222999999999999
10710^7252599999989999998
10810^828289999999599999995

The only instance we have here of 10k10^k and 10k+110^{k+1} having the same longest chain is 10210^2 and 10310^3 with 99 being the longest in both cases. On a whim, I decided to check 999 and found that c(99)=c(999)=22c(99)=c(999)=22. So, you could write that the starting number for the longest chain is indeed 999 rather than 99.

I wonder how long all the other chains for 10k110^k-1 are?

Starting numberLongest chain
101110^{1}-166
102110^{2}-11212
103110^{3}-11212
104110^{4}-11717
105110^{5}-12020
106110^{6}-12222
107110^{7}-12525
108110^{8}-12828
109110^{9}-13030
1010110^{10}-13636
1011110^{11}-13636
1012110^{12}-14141
1013110^{13}-14444
1014110^{14}-14646

Another hypothesis

The first few lengths here seem to line up with the longest chains from the previous table. That leads me to my next conjecture.

Conjecture 2: The longest chain produced by a starting number under 10k10^k is exactly the length of the chain produced by 10k110^k-1. In other words, c(n)c(10k1)c(n)\leq c(10^k-1) for all n<10kn<10^k.

This makes intuitive sense to me after playing around with a few of these, as 9 takes a while to start producing 4’s.

Conclusion and questions

I won’t be proving either of these conjectures today, as fun as it was exploring this topic. The proofs (or proofs to the contrary) will be left as exercises for the reader.

All of the code I used to produce these figures and tables will be available on my GitHub. If you are reading this sentence, I have yet to upload it, but you can check out some of my other projects on my GitHub page.

Thanks for reading.