Well, the answer is that it has to be infinitely long, but the question is what is the most compact form of a Normal Number possible.

I was motivated to look into this from a lovely Numberphile video about all the real numbers.

Normal numbers in base 10 are those for which, in the base 10 decimal expansion, you can find every natural number.

Champernowne’s number is a very simple example of this where it is simply written as:

0.12345678910111213…etc.

I thought that it might be interesting to see if one could write a more compact Normal Number, but using a similar procedure to Champernowne. I haven’t seen this done anywhere else. For example, in the above expression, you don’t need to include the 12 explicitly as it’s already there at the beginning. You could write

0.12345678910113

So you skip the 12, and also 11 and 13 becomes 113. We will do all of this just with the list of digits, rather than the number in base 10. ie. the above would be {0,1,2,3,4,5,6,7,8,9,1,0,1,1,3}.

I wanted to write some Mathematica code which generated such a Normal Number in as short a way as possible. This is what I’ve come up with, but I wonder if there may be a better way.

isitthere[seq_, n_] := SequencePosition[seq, IntegerDigits[n]]

This takes a sequence of numbers, for instance {0,1,2,3,4,5} and sees if the integer digits of, for instance 34 are in there. It will output the position if it’s there, or simply {} if it’s not there.

id = IntegerDigits[n];
len = Length[id];
For[i = 1, i < len, i++,
If[seq[[i – len ;;]] == id[[;; -i – 1]],
Return[ Join[seq, id[[-i ;;]]]]]
];
Return[ Join[seq, id]]
]

This sees if any of the values in the integers digits of n appear at the back of the sequence, and if they do, then it adds on only the bare minimum. For instance, if you have {1,2,3,4,5} and you want to make sure that 456 is there, then it will just add the 6 and return {1,2,3,4,5,6}

Now, starting with just {1}, we can run through every integer (here up to 200) and make sure that it either appears in the sequence, or we add the bare minimum to the sequence to make sure that it’s there:
start = {1};
For[m = 1, m <= 200, m++,
If[isitthere[start, m] === {}, start = addtoseq[start, m]]
]

And this takes the output of the above and gives us the base 10 number:

N[FromDigits[start]/10^Length[start], Length[start]]

which gives:

0.1234567891011314151617181920212242526272829303233536373839404344647484950545575859606566869707677980878890991001021031041051061071081091101112114115116117118119120124125126127128129130132133134135136137138139140142143144145146147148149150152153154155156157158159160162163164165166167168169170172173174175176177178179180182183184185186187188189190193194195196197198199200

If you can think of a shorter way of generating a Normal Number in base 10, I’d love to see.

 How clear is this post?