Re: [math-fun] 3-coloring the rationals
In terms of the Newman enumeration of the rationals In[596]:= NestList[1/(2 Floor@# - # + 1) &, 0, 42] Out[596]= {0, 1, 1/2, 2, 1/3, 3/2, 2/3, 3, 1/4, 4/3, 3/5, 5/2, 2/5, 5/3, 3/4, 4, 1/5, 5/4, 4/7, 7/3, 3/8, 8/5, 5/7, 7/2, 2/7, 7/5, 5/8, 8/3, 3/7, 7/4, 4/5, 5, 1/6, 6/5, 5/9, 9/4, 4/11, 11/7, 7/10, 10/3, 3/11, 11/8, 8/13} In[595]:= color[r_?NumberQ] := col[{0, R}, r, {ComplexInfinity, B}] In[582]:= col[L_, r_, H_] := Block[{m}, Which[L[[1]] == r, L[[2]], H[[1]] == r, H[[2]], r < (m = {Mediant[L[[1]], H[[1]]], Complement[{R, G, B}, {L[[2]], H[[2]]}][[1]]})[[1]], col[L, r, m], True, col[m, r, H]]] In[597]:= color /@ %596 Out[597]= {R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R, G, B, R} Taking every other term (i.e., restricting to [0/1,1/1]) still gives a 3-coloring. (Mediant works given ComplexInfinity because In[591]:= Denominator@ComplexInfinity Out[591]= 0 Yay!) --rwg On 2016-04-17 19:53, Tom Karzes wrote:
This statement is true for rationals between 0 and 1. You cannot obtain rationals greater than 1 if you only consider the half of the s-b tree between 0/1 and 1/1.
For rationals greater than 1, it still works if you throw (1/0) into the mix (i.e., treat it as a rational) and color it green. But if you don't consider (1/0) to be a rational, then you could break the pattern by coloring both (0/1) and (1/0) the same color, e.g. red. And you could then choose any color for (1/1), but if you force it to blue, then you get the same color for any a/b and b/a, as opposed to red/green reversal if you allow (1/0) as a rational.
Tom
James Propp writes:
For uniqueness, one may cite the theory of Farey fractions and the Stern-Brocot tree. Every rational can be obtained by an iterative process of inserting mediants, starting from 0/1 and 1/1. This means that at each stage one has no choice (that is to say, that one has 1 choice).
participants (1)
-
Bill Gosper