Described herein is a method that includes storing partial quotients of a
continued fraction in a first set of counters, initializing a second sets
of counters with counter values, decrementing a target counter in the
second set of counters to obtain a decremented counter value, and
outputting a value that corresponds to a partial quotient in a first
counter in the first set of counters. The value is based on the
decremented counter value.