The proper
arbitrary fraction of p/q is used to find the closest fraction in the binary
search that reduce the search range of ranks. The properties of Farey’s
sequences are used to prove the GCD theorem here. The first step is to measure
the range of the sequence that can be obtained by different ways. Suppose the
search key is p/q and range become . Consider two
properties of Farey sequence for gcd theorem.
The
fractions are now in the ascending order of and the binary search provides the close
values of to get the fraction that is close to p/q in
the function.
Using
the property 3 for the maximum rank in the function it gives
Considering
the corresponding binary search for the key fraction. The plots define the gcd
theorem with fraction difference and key values are under the rank defined
above that is as a key fraction p/q. from the explicit
evaluation of function and theorem it gives values p and q. consider that p and
q are both coprime and c = 1 the rule
become as c = gcd (p, q)