Order Statistics in the Farey Sequences in Sublinear Time Jakub Pawlewicz Institute of Informatics, Warsaw University Banacha 2, 02-097 Warsaw, Poland
[email protected] Abstract. The paper presents the first sublinear algorithm for comput- ing order statistics in the Farey sequences. The algorithm runs in time p O(n3=4 log n) and in space O( n ) for Farey sequence of order n. This is a significant improvement to the algorithm from [1] that runs in time O(n log n). 1 Introduction The Farey sequence of order n (denoted Fn) is the increasing sequence of all irreducible fractions from interval [0; 1] with denominators less than or equal to n. The Farey sequences have numerous interesting properties and they are well known in the number theory and in the combinatorics. They are deeply investigated in [2]. In this paper we study the following algorithmic problem. For given positive integers n and k compute the k-th element of the Farey sequence of order n. This problem is known as order statistics problem. The solution to the order statistics problem is based on a solution to a related rank problem, i.e. the problem of finding the rank of a given fraction in the Farey sequence. Both, the order statistics problem and the rank problem, can be easily solved in quadratic time by listing all elements of the sequence (see [2, Problem 4-61] and Section 2.1). Faster solutions for order statistics are possible by reducing the main problem to the rank problem. The roughly linear time algorithm is presented in [1].