Skip to Main Content
Three different algorithms are described for the conversion of Hensel codes to Farey rationals. The first algorithm is based on the trial and error factorization of the weight of a Hensel code, inversion and range test. The second algorithm is deterministic and uses a pair of different p-adic systems for simultaneous computation; from the resulting weights of the two different Hensel codes of the same rational, two equivalence classes of rationals are generated using the respective primitive roots. The intersection of these two equivalence classes uniquely identifies the rational. Both the above algorithms are exponential (in time and/or space).