# Does every irrational number contain arbitrarily long sequences of some digit?

Suppose we have an irrational number represented in base $3$ such that there can only be a maximum of $n$ consecutive $1$'s or $2$'s in the ternary expansion. Does this imply there are arbitrarily long sequences of $0$'s in the expansion? Or does such a number even exist?

• Take pi and between every pair of digits that are the same, insert a different digit. – BlueRaja - Danny Pflughoeft Sep 5 '15 at 3:47
• The phrase "sequences of $1$'s and $2$'s" is not quite clear. Do you mean sequences that either contain only $1$'s or contain only $2$'s (which gives a fairly weak condition, and which interpretation at least one answer appears to assume) or merely a sequence in which the digit $0$ is absent (giving a stronger condition)? (In either case the answers are "no" and "yes", but it should be made clear what the question was.) – Marc van Leeuwen Sep 5 '15 at 4:03
• Powers of any prime contain arbitrarily long sequences of some digit. See math.stackexchange.com/questions/1261980/… – user236182 Sep 5 '15 at 11:41

Consider the substitution $1\mapsto 12,\: 2\mapsto 1$ and iterate this. So $$1\mapsto 12 \mapsto 121\mapsto 12112 \mapsto 12112121 \mapsto \ldots$$ This has a limit word $w$ which respresents an irrational number in ternary (the number $0.w$)

$$0.12112121121121211212112112121121121211212112112121121211211212112112121 \cdots$$ It is irrational because the sequence is not eventually periodic. You can prove this by showing that the ratio of $1$s and $2$s in its expansion is the golden ratio. You can also prove pretty easily that every $2$ is isolated, so it always appears surrounded by two $1$s, and there are no runs of more than two consecutive $1$s.

• What is known about this number? Is it transcendental? – marty cohen Sep 5 '15 at 0:32
• A lot is known about the sequence and it's dynamical properties. It's called the Fibonacci word, a special example of a Sturmian word. I've never thought about your question before but a quick search suggests that it is transcendental! (I hope I'm not misinterpreting the statement of their result) – Dan Rust Sep 5 '15 at 0:39
• @martycohen Your guess is certainly wrong: there are lots of numbers that are rational but can't be easily proven rational. For example, let $x = \pi$ if the Riemann hypothesis is true and $0$ if it's false, and let $y = \pi - x$. One of $x$ and $y$ is a counterexample to your guess (we don't happen to know which one). – Robert Israel Sep 5 '15 at 1:11
• @MarcvanLeeuwen That's not the point. The point is that we can't easily prove $x$ rational or algebraic. We also can't easily prove $y$ rational or algebraic. So based on the earlier comment, $x$ would be transcendental, and so would $y$. That isn't right: we do know either $x$ is rational, or $y$ is rational. – hvd Sep 5 '15 at 7:56
• @RobertIsrael: On the other hand, every number that is rational or algebraic has a description from which one easily proves that it is rational/algebraic. What is true that there are many descriptions of numbers that happen to be rational, where it cannot be proved that this description describes a rational number. – Henning Makholm Sep 5 '15 at 13:53

You can have an irrational number with no consecutive pairs of $0$s, $1$s or $2$s such as

$$0.120121201212120121212120\ldots$$ where the number of $12$s between $0$s increases each time.

Consider the number whose ternary expansion is

$$0.\underbrace{1^n22}\underbrace{1^n21^n22}\underbrace{1^n21^n21^n22}\ldots\;,$$

where the exponents indicate repetition. In other words, if $b=1^n2$, the number (ignoring leading $0$ and ternary point) is

$$b2b^22b^32b^42\ldots\;.$$

No sequence of consecutive $1$s is longer than $n$, and no sequence of consecutive $2$s is longer than $2$, but the number is clearly irrational.

Knowing that every sequence of digits defines a real number, and that this number is rational if and only if the sequence is periodic, you question is very easy to answer.

In the stronger interpretation, your hypothesis says that every $n$ consecutive digits must contain a digit $0$. Then if $n\leq1$, all your digits must be $0$, and the number is rational (I assume you did not mean this, but I want my answer to be complete). If $n>1$, then one can already satisfy the condition by making every $n$-th digit a $0$; the remaining digits can be filled in later. Assuming such a sequence, is easy to see that if the whole sequence were periodic, it would still be periodic after removing those digits $0$ at every $n$-th position. By contrapositive, if we can choose the remaining digits in a non-periodic way, the whole sequence will not be periodic, and the number irrational; we'll have a number like you asked for.

So your question becomes, under the assumption of those already fixed digits $0$, (1) must a non-periodic sequence (of remaining digits) contain arbitrarily long sequences of digits $0$, and (2) do such non-periodic sequences even exist. As you see this is really obvious to answer: (2) yes non-periodic sequences exist (as do irrational numbers), and (1) no, they don't even need to contain any digits $0$, let alone arbitrarily long sequences of such digits.

Start with any irrational number (between $0$ and $1$ for convenience) in ternary expansion and translate the digits after the initial "$0.$" per $0\mapsto 1212$, $1\mapsto 1202$, $2\mapsto 1012$. The the resulting number is also irrational (because nonperiodic) and there are no runs of digits longer than $1$.

• I really like this, especially as it's a contracting map on the set of irrationals, so it has a unique fixed point! 0.1202101212121012120212121202101212021012120210121202121212021012120210121212101212021012120210121202101212121012120212121202101212021012121210121202121212021012120.... – Dan Rust Sep 6 '15 at 2:29