# Circuit depth of computing the continued fractions of a rational number

If you want to convert a rational number into its continued fraction, what is the circuit depth of this process, in terms of the total number of bits of input?

I was reading through some notes which mentioned that the work being done while computing the continued fraction is basically the same as the work being done while computing a GCD. Are their circuit depths similar?

• Is your question assuming that the Euclidean algorithm has the optimal circuit depth for computing the GCD? Is that known? If not, it might be important to distinguish "optimal circuit depth for the Euclidean algorithm" vs "optimal circuit depth for computing the GCD".
– D.W.
Commented Feb 6, 2020 at 23:09
• @D.W. No, I was just stating that a valid answer could be of the form "yes this problem does reduce to GCD and also here is the best known depth for GCD". Commented Feb 7, 2020 at 0:15
• Let me state it differently, then: the notes you point to don't say that the work is the same as done while computing a GCD, exactly. They say it is the same as the work that is done while using the Euclidean algorithm to compute a GCD. (There are other ways to compute a GCD.) It seems likely that the optimal circuit depth for computing the continued fraction is the same as the optimal circuit depth for implementing the Euclidean algorithm (you should be in a position to check if that's right), which is at least the optimal circuit depth for computing the GCD. Dunno if that helps.
– D.W.
Commented Feb 7, 2020 at 2:11
• What notion of circuit are you interested in? Commented Feb 7, 2020 at 3:51
• @YuvalFilmus ANDs, ORs, and XORs with constant fan-in. Circuits you would imagine making when designing actual hardware. Commented Feb 7, 2020 at 11:44