%I #34 Mar 01 2023 04:47:45
%S 0,0,0,2,2,2,4,6,8,8,12,14,18,18,20,26,28,32,32,40,42,46,48,58,58,66,
%T 76,78,84,88,94,100,106,114,120,126,128,142,150,162,166,178,178,194,
%U 200,206,214,230,236,246,250,266,274,292,296,312,322,338,344,360,360,388,400,408,416,436
%N Consider the Farey sequence of order n, F_n, and that the average distance between any two adjacent pairs in F_n is 1/A002088(n). Then a(n) is the number of adjacent pairs whose difference is less than the average.
%C Because the Farey fractions are symmetrical about 1/2, a(n) is always even.
%C Conjecture: this is a monotonic sequence. For n = 0, 1, 3, 4, 8, 12, 17, 23, 41 & 59, a(n) = a(n+1).
%C If instead the question is when the difference is equal to the average, then the sequence becomes 0, 1, 2, 0, 2, 2, 2, 0, 0, 2, 0, 2, 0, 0, 0, 2, 2, 0, 2, 2, 0, 2, 0, 0, 2, 2, ..., . A262670.
%C Conjecture: Twice the number of pairs less than the average (2*A262669) plus the number of pairs which equal the average (A262670) never exceed the number of pairs which are greater than the average for n greater than 245.
%C f( 1000) = 100972,
%C f( 2000) = 403750,
%C f( 3000) = 908068,
%C f( 4000) = 1614072,
%C f( 5000) = 2522376,
%C f( 6000) = 3631762,
%C f( 7000) = 4943332,
%C f( 8000) = 6456904,
%C f( 9000) = 8171296,
%C f(10000) = 10088132.
%D Albert H. Beiler, Recreations in the Theory of Numbers, The Queen of Mathematics Entertains, Chapter XVI, "Farey Tails", Dover Books, NY, 1966, pgs 168-172.
%H Robert G. Wilson v, <a href="/A262669/b262669.txt">Table of n, a(n) for n = 0..5000</a>
%H Cut the Knot, <a href="http://www.cut-the-knot.org/blue/Farey.shtml">Farey Series</a>.
%H The University of Surrey, Math Dept., <a href="https://r-knott.surrey.ac.uk/Fractions/fareySB.html">Fractions in the Farey Series and the Stern-Brocot Tree</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/FareySequence.html">Farey Sequence</a>.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Farey_sequence">Farey Sequence</a>.
%F a(n) = (n/Pi)^2 + O(n/3*(log(n))^(2/3)*(log(log(n)))^(4/3)), (A. Walfisz 1963).
%e a(5) = 2. F_5 = {0, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1} and the first forward difference is {1/5, 1/20, 1/12, 1/15, 1/10, 1/10, 1/15, 1/12, 1/20, 1/5}. The average distance is 1/10 since A002088(5) = 10 which is also the number of adjacent pairs, a/b & c/d.
%t f[n_] := Block[{diff = Differences@ Union@ Flatten@ Table[a/b, {b, n}, {a, 0, b}], ave = 1/Sum[ EulerPhi[ m], {m, n}]}, {Length@ Select[diff, ave < # &], Length@ Select[diff, ave == # &], Length@ Select[diff, ave > # &]}]; Array[ f[#][[1]] &, 65, 0]
%Y Cf. A002088, A005728, A006843, A262670.
%K nonn
%O 0,4
%A _Robert G. Wilson v_, Sep 26 2015