(Below) was the first message in a voluminous, ten day discussion of what happens when you run Newman's rational number enumerator backwards on an irrational. E.g., on coth 1 = 1 3 5 7 9 ..., it takes 242 steps to scrozzle the 7: Column@NestList[{#, ContinuedFraction[#, 9]} &@Oldman@#[[1]] &, {Coth@1, Range[1, 17, 2]}, 242] {Coth[1],{1,3,5,7,9,11,13,15,17}} {1-Tanh[1],{0,4,5,7,9,11,13,15,17}} {1/2 (17-E^2),{4,1,4,7,9,11,13,15,17}} {1+2/(-17+E^2),{0,1,3,1,4,7,9,11,13}} {(2 (-14+E^2))/(-15+E^2),{1,1,2,1,4,7,9,11,13}} {(-13+E^2)/(2 (-14+E^2)),{0,2,2,1,4,7,9,11,13}} {(-37+3 E^2)/(-13+E^2),{2,1,1,1,4,7,9,11,13}} {(2 (-12+E^2))/(-37+3 E^2),{0,1,1,1,1,1,4,7,9}} {(35-3 E^2)/(24-2 E^2),{1,2,1,1,4,7,9,11,13}} {(-11+E^2)/(-35+3 E^2),{0,3,1,1,4,7,9,11,13}} {(-42+4 E^2)/(-11+E^2),{3,2,4,7,9,11,13,15,17}} {(31-3 E^2)/(42-4 E^2),{0,1,2,2,4,7,9,11,13}} {(51-5 E^2)/(31-3 E^2),{1,1,1,2,4,7,9,11,13}} {(2 (-10+E^2))/(-51+5 E^2),{0,2,1,2,4,7,9,11,13}} {(49-5 E^2)/(20-2 E^2),{2,3,4,7,9,11,13,15,17}} {(29-3 E^2)/(49-5 E^2),{0,1,1,3,4,7,9,11,13}} {(38-4 E^2)/(29-3 E^2),{1,4,4,7,9,11,13,15,17}} {(-9+E^2)/(-38+4 E^2),{0,5,4,7,9,11,13,15,17}} {(-61+7 E^2)/(-9+E^2),{5,1,3,7,9,11,13,15,17}} {(52-6 E^2)/(61-7 E^2),{0,1,4,1,3,7,9,11,13}} [. . .] {(814-108 E^2)/(505-67 E^2),{1,1,1,1,1,3,1,7,9}} {(309-41 E^2)/(814-108 E^2),{0,2,1,1,1,3,1,7,9}} {(731-97 E^2)/(309-41 E^2),{2,2,1,3,1,7,9,11,13}} {(422-56 E^2)/(731-97 E^2),{0,1,1,2,1,3,1,7,9}} {(535-71 E^2)/(422-56 E^2),{1,3,1,3,1,7,9,11,13}} {(113-15 E^2)/(535-71 E^2),{0,4,1,3,1,7,9,11,13}} {(482-64 E^2)/(113-15 E^2),{4,4,1,7,9,11,13,15,17}} {(369-49 E^2)/(482-64 E^2),{0,1,3,4,1,7,9,11,13}} {(625-83 E^2)/(369-49 E^2),{1,1,2,4,1,7,9,11,13}} {(256-34 E^2)/(625-83 E^2),{0,2,2,4,1,7,9,11,13}} {(655-87 E^2)/(256-34 E^2),{2,1,1,4,1,7,9,11,13}} {(399-53 E^2)/(655-87 E^2),{0,1,1,1,1,4,1,7,9}} {(542-72 E^2)/(399-53 E^2),{1,2,1,4,1,7,9,11,13}} {(143-19 E^2)/(542-72 E^2),{0,3,1,4,1,7,9,11,13}} {(459-61 E^2)/(143-19 E^2),{3,5,1,7,9,11,13,15,17}} {(316-42 E^2)/(459-61 E^2),{0,1,2,5,1,7,9,11,13}} {(489-65 E^2)/(316-42 E^2),{1,1,1,5,1,7,9,11,13}} {(173-23 E^2)/(489-65 E^2),{0,2,1,5,1,7,9,11,13}} {(376-50 E^2)/(173-23 E^2),{2,6,1,7,9,11,13,15,17}} {(203-27 E^2)/(376-50 E^2),{0,1,1,6,1,7,9,11,13}} {(233-31 E^2)/(203-27 E^2),{1,7,1,7,9,11,13,15,17}} {(30-4 E^2)/(233-31 E^2),{0,8,1,7,9,11,13,15,17}} {(277-37 E^2)/(30-4 E^2),{8,8,9,11,13,15,17,19,21}} Am I the only one who failed to notice, e.g., 1+3+5 (= 3²) = 0+4+5 = 4+1+4= ... = 0+1+4+1+3 = [. . .] = 1+1+1+1+1+3+1 =...=0+8+1 ? And then, of course, 1+3+5+7 (= 4²) = 8+8 = ... . --rwg On Thu, Nov 14, 2013 at 3:39 AM, Bill Gosper <billgosper@gmail.com> wrote:
This must have been found by Newman himself but I only just noticed. Enumerate the nonnegative rationals by iterating "Newman's function": In[96]:= NestList[1/(2*Floor[#] + 1 - #) &, 0, 9]
Out[96]= {0, 1, 1/2, 2, 1/3, 3/2, 2/3, 3, 1/4, 4/3}
"Oldman's function" runs the sequence back to 0, counting the rationals:
In[97]:= NestList[2*Ceiling[1/#] - 1 - 1/# &, 4/3, 9]
Out[97]= {4/3, 1/4, 3, 2/3, 3/2, 1/3, 2, 1/2, 1, 0}
E.g., 0 is the zeroth rational, 4/3 is the ninth.
Oldman is completely unnecessary!
Just negate and reciprocate the last value, and Newman runs backwards:
In[100]:= NestList[1/(2*Floor[#] + 1 - #) &, -3/4, 9]
Out[100]= {-3/4, -4, -1/3, -3/2, -2/3, -3, -1/2, -2, -1, ComplexInfinity}
(with a much louder completion announcement).
Or if you prefer, Oldman runs the negative rationals forwards:
In[99]:= NestList[2*Ceiling[1/#] - 1 - 1/# &, -1, 9]
Out[99]= {-1, -2, -1/2, -3, -2/3, -3/2, -1/3, -4, -3/4, -5/3}
obviating Newman. --rwg