Mapping integers and hensel codes onto Farey fractions

The order-N Farey fractions, whereN is the largest integer satisfyingN≦√((p−1)/2), can be mapped onto a proper subset of the integers {0, 1,...,p−1} in a one-to-one and onto fashion. However, no completely satisfactory algorithm for affecting the inverse mapping (the mapping of the integers back onto the order-N Farey fractions) appears in the literature.A new algorithm for the inverse mapping problem is described which is based on the Euclidean Algorithm. This algorithm solves the inverse mapping problem for both integers and the Hensel codes of Krishnamurthy et al.