Analysis of the Continued Logarithm Algorithm

  • Pablo Rotondo
  • Brigitte Vallée
  • Alfredo Viola
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10807)


The Continued Logarithm Algorithm –CL for short– introduced by Gosper in 1978 computes the gcd of two integers; it seems very efficient, as it only performs shifts and subtractions. Shallit has studied its worst-case complexity in 2016 and showed it to be linear. We here perform the average-case analysis of the algorithm: we study its main parameters (number of iterations, total number of shifts) and obtain precise asymptotics for their mean values. Our “dynamical” analysis involves the dynamical system underlying the algorithm, that produces continued fraction expansions whose quotients are powers of 2. Even though this CL system has already been studied by Chan (around 2005), the presence of powers of 2 in the quotients ingrains into the central parameters a dyadic flavour that cannot be grasped solely by studying the CL system. We thus introduce a dyadic component and deal with a two-component system. With this new mixed system at hand, we then provide a complete average-case analysis of the CL algorithm, with explicit constants (Thanks to the Dyna3S ANR Project and the AleaEnAmsud AmSud-STIC Project.).


  1. 1.
    Borwein, J.M., Hare, K.G., Lynch, J.G.: Generalized continued logarithms and related continued fractions. J. Integer Seq. 20, 51 p. (2017). Article no. 17.5.7Google Scholar
  2. 2.
    Bourbaki, N.: Variétés différentielles et analytiques. Springer, Heidelberg (2007). zbMATHGoogle Scholar
  3. 3.
    Chan, H.-C.: The asymptotic growth rate of random Fibonacci type sequences. Fibonacci Q. 43(3), 243–255 (2005)MathSciNetzbMATHGoogle Scholar
  4. 4.
    Daireaux, B., Maume-Deschamps, V., Vallée, B.: The Lyapounov tortoise and the dyadic hare. In: Proceedings of AofA 2005, DMTCS, pp. 71–94 (2005)Google Scholar
  5. 5.
    Delange, H.: Généralisation du Théorème d’Ikehara. Ann. Sc. ENS 71, 213–242 (1954)zbMATHGoogle Scholar
  6. 6.
    Gosper, B.: Continued fraction arithmetic (1978, unpublished manuscript)Google Scholar
  7. 7.
    Koblitz, N.: \(p\)-adic Numbers, \(p\)-adic Analysis and Zeta Functions, 2nd edn. Springer, New York (1984). CrossRefzbMATHGoogle Scholar
  8. 8.
    Shallit, J.: Length of the continued logarithm algorithm on rational inputs (2016)., arXiv:1606.03881v2
  9. 9.
    Vallée, B.: Dynamics of the binary Euclidean algorithm: functional analysis and operators. Algorithmica 22(4), 660–685 (1998)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Vallée, B.: Euclidean dynamics. Discret. Continuous Dyn. Syst. 15(1), 281–352 (2006)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  • Pablo Rotondo
    • 1
    • 2
    • 3
  • Brigitte Vallée
    • 2
  • Alfredo Viola
    • 3
  1. 1.IRIF, CNRS and Université Paris DiderotParisFrance
  2. 2.GREYC, CNRS and Université de CaenCaenFrance
  3. 3.Universidad de la RepúblicaMontevideoUruguay

Personalised recommendations