%I #21 Sep 06 2021 11:54:16
%S 1,0,1,2,3,4,7,10,13,16,19,22,25,47,69,91,113,135,157,179,201,223,245,
%T 267,289,311,333,355,688,1043,1398,1753,2108,2463,2818,3173,3528,3883,
%U 4238,4593,4948,5303,5658,6013,6368,6723,7078,7433,7788,8143,8498,8853
%N Numerators of "Farey fraction" approximations to Pi.
%C Given a real number x >= 1 (here x = Pi), start with 1/0 and 0/1 and construct the sequence of fractions f_n = r_n/s_n such that:
%C f_{n+1} = (r_k + r_n)/(s_k + s_n) where k is the greatest integer < n such that f_k <= x <= f_n. Sequence gives values r_n.
%C Write a 0 if f_n <= x and a 1 if f_n > x. This gives (for x = Pi) the sequence 1, 0, 0, 0, 1, 1, 1, 1, 0 (7 times), 1 (15 times), 0, 1, ... Ignore the initial string 1, 0, 0, 0, which is always the same. Look at the run lengths of the remaining sequence, which are in this case L_1 = 4, L_2 = 7, L_3 = 15, L_4 = 1, L_5 = 292, etc. (A001203). Christoffel showed that x has the continued fraction representation (L_1 - 1) + 1/(L_2 + 1/(L_3 + 1/(L_4 + ...))).
%D C. Brezinski, History of Continued Fractions and Padé Approximants, Springer-Verlag, 1991; pp. 151-152.
%D E. B. Christoffel, Observatio arithmetica, Ann. Math. Pura Appl., (II) 6 (1875), 148-153.
%H Dave Rusin, <a href="http://www.math.niu.edu/~rusin/known-math/99/farey">Farey fractions on sci.math</a> [Broken link]
%H Dave Rusin, <a href="/A002965/a002965.txt">Farey fractions on sci.math</a> [Cached copy]
%e The fractions are 1/0, 0/1, 1/1, 2/1, 3/1, 4/1, 7/2, 10/3, 13/4, 16/5, 19/6, 22/7, 25/8, 47/15, ...
%t f[x_, n_] := (m = Floor[x]; f0 = {m, m+1/2, m+1};
%t r = ({a___, b_, c_, d___} /; b < x < c) :> {b, (Numerator[b] + Numerator[c]) / (Denominator[b] + Denominator[c]), c}; Join[{m, m+1}, NestList[# /. r &, f0, n-3][[All, 2]]]); Join[{1, 0, 1, 2}, f[Pi, 48]] // Numerator (* _Jean-François Alcover_, May 18 2011 *)
%Y Cf. A097546.
%K nonn,frac,nice,easy,look
%O 0,4
%A _N. J. A. Sloane_, Aug 28 2004
%E More terms from _Joshua Zucker_, May 08 2006