Puzzle: Coloring the Real number line problem
Can you paint the real number line using three colors such that

*

*each real number is in a non-trivial interval (singletons not allowed) that is painted a single color; and

*between any two points of different colors, there is a point that is the third color?

*all three colors must be used

current attempts thus far:
approach 1

*

*Color all unit intervals $[N,N+1)$ red (where $N$ is an integer).

*Remove the right 1/3 (in absolute distance, not in proportion) of each interval and replace it with a blue interval that is closed on the left and open on the right.

*Remove the right 1/9 (in absolute distance, not in proportion) of each interval and replace it with a green interval that is closed on the left and open on the right.

*Remove the right $\frac{1}{3^n}$ (in absolute distance, not in proportion) of each interval and replace it with the "other" color.

At step 4 we recurse forever.
approach 2
Encode the real number line in base 7 and if first odd digit in the decimal expansion after the decimal point is a 1 then make the number red, if it's 3 then green, if it's 5 then blue.
problems with these approaches
Approach 1 has a countable infinity of points where the color is not defined. Consider 1/2 which is at the right side of one of the original red intervals and is open on the right. It's at the closed left side of an infinitesimally small interval that is green or blue... or is it, the recursion is constantly changing the colors back and forth.
Approach 2 has an uncountable(?) infinity of points where the color is undefined, the set of all points that a decimal expansion composed entirely of even digits.
 A: It is not possible to do so.
First, all of the (maximal) monochrome intervals have to be closed intervals. (For the purposes here, $[a,+\infty)$ and $(-\infty,a]$ are considered closed intervals.)
This is because if, for some real $a,$ $(a,b]$ or $(a,b)$ is a maximal monochrome interval, then $a$ has a different color, and there is no element between $a$ and any $x\in(a,b)$ of the third color.
So, if we are to construct such a coloring, it means we have to cover the real line with disjoint non-trivial closed intervals.
But according to this link, it is impossible to cover the real line with disjoint non-trivial closed intervals.
The proof there is that if there is such a covering, then the set $E$ of endpoints of the intervals is countably infinite, closed, and every element of $E$ is a limit point of $E.$ Those are all relatively easy to show.

*

*$E$ is closed. Let the intervals be $[a_n,b_n].$ Then $\bigcup (a_n,b_n)$ is open, and $E$ is the complement.


*$E$ is countable. This is because we can pick distinct rationals from each interval, and thus we must have countably many intervals. There are at most $2$ endpoints per interval ($(-\infty,a]$ and $[a,+\infty)$ only have one.)


*If $[a,b]$ is an interval, then for any $n,$ pick $x\in (a-1/n,a).$ Then $x\in[a_n,b_n]$ for another interval. But then $a-1/n<x\leq b_n$ and $b_n<a,$ so $b_n\in (a-1/n,a).$ $b_n\to a.$ Likewise for sequences of left-endpoints converging to $b.$
That means $E$ is a countably infinite "perfect set," and the Baire Category Theorem says there is no such thing in a complete metric space.
We can prove it directly. Outlined here.
Let $E=\{x_1,x_2,\dots\}$ be an enumeration of the endpoints.
The proof finds a sequence of closed balls $B_n$ (intervals in our case) such that $B_{n+1}\subseteq B_n$ and $B_n$ does not contain any of $x_1,\dots,x_n,$ the radius of $B_{n+1}$ is at most $1/2$ the radius of $B_n$, and $B_{n+1}$ is centered on another element of $E.$
Then the intersection of the closed intervals $B_n$ cannot have any element of $E,$ but the centers are a Cauchy sequence, and thus must converge, which, since $E$ is closed, must be contained in $E.$
A: Here is an alternate proof that $\mathbb{R}$ is not the union of more than one disjoint closed interval.  We continue with the convention that $(-\infty,a]$ and $[a,\infty)$ are regarded as closed intervals, but singletons are not.
Apology: I realise that many, many answers to this have been posted across the many linked posts and articles.  I justify this post with the hope that the picture will make intuitive how to come up with this argument, without guidance from any theorems known in advance.

Assume that some collection of (more than one) disjoint closed intervals covers $\mathbb{R}$.
Let $x_0=0$.  It lies in one of the intervals, which we denote $B_0$.  Let $x_1\in \mathbb{R}$ be greater than any element of $B_0$.  Then $x_1$ is also in one of the intervals which we denote $B_1$.
Now let $x_{0.1}$ denote the midpoint of the gap between $B_0$ and $B_1$.  Let $B_{0.1}$ denote the interval that $x_{0.1}$ lies in.  Note all decimals should be read in binary.
We continue to define $x_{0.01}$ as the midpoint of the gap between $B_0$ and $B_{0.1}$ and $x_{0.11}$ as the midpoint of the gap between $B_{0.1}$ and $B_{1}$.  Again we denote by $B_{0.01}$ and $B_{0.11}$ the intervals which contain $x_{0.01}$ and $x_{0.11}$ respectively.

We continue this process inductively:  Each new generation of intervals is obtained by taking the intervals from the cover, which contain the midpoints of the gaps between the previous intervals.  In particular, given consecutive dyadic rationals $s,t$ from one generation, the midpoint of the gap between $B_s$ and $B_t$ is labelled $x_{(s+t)/2}$, and the interval containing it is labeled $B_{(s+t)/2}$.
Note that maximum length of a gap between intervals at least halves going from one generation to the next, as the new $x_s$ bisect the gaps between the old $B_t$.  Thus there is no interval disjoint from the union of the $B_s$ over all dyadic rationals $s$.  We conclude that our original cover is precisely the $B_s$, for dyadic rationals $s$.
It remains only to find a point not in any of the $B_s$.  Simply take an irrational number $t\in [0,1]$:
$$t=0.t_1t_2t_3t_4t_5\cdots,$$
where each $t_i\in \{0,1\}$.
Let $x$ be the limit of the Cauchy sequence $$x_{0.t_1}, x_{0.t_1t_2},x_{0.t_1t_2t_3}, \cdots$$
For any interval $B_s$, this sequence will eventually be constrained to some gap between the intervals in the generation where $B_s$ appears.  This gap may be to the left or right of $B_s$.
As $t$ is irrational, its binary decimal expansion does not end in an infinite sequence of $0$'s.  Thus if the sequence eventually lies in a gap to the right of $B_s$, at some later point it will lie in a gap to the right of an interval $B_r$, which is to the right of $B_s$.
Similarly as $t$ is irrational, its binary decimal expansion does not end in an infinite sequence of $1$'s.  Thus if the sequence eventually lies in a gap to the left of $B_s$, at some later point it will lie in a gap to the left of an interval $B_r$, which is to the left of $B_s$.
We conclude $x\notin B_s$.
