A Binary Recursive Gcd Algorithm

  • Damien Stehlé
  • Paul Zimmermann
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3076)


The binary algorithm is a variant of the Euclidean algorithm that performs well in practice. We present a quasi-linear time recursive algorithm that computes the greatest common divisor of two integers by simulating a slightly modified version of the binary algorithm. The structure of our algorithm is very close to the one of the well-known Knuth-Schönhage fast gcd algorithm; although it does not improve on its O(M(n) log n) complexity, the description and the proof of correctness are significantly simpler in our case. This leads to a simplification of the implementation and to better running times.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Brent, R.P.: Twenty years’ analysis of the binary Euclidean algorithm. In: Roscoe, A.W., Davies, J., Woodcock, J. (eds.) Millenial Perspectives in Computer Science: Proceedings of the 1999 Oxford-Microsoft Symposium in honour of Professor Sir Antony Hoare, Palgrave, New York, pp. 41–53 (2000)Google Scholar
  2. 2.
    Brent, R.P., Kung, H.T.: A systolic VLSI array for integer GCD computation. In: Hwang, K. (ed.) Proceedings of the 7th Symposium on Computer Arithmetic (ARITH-7), IEEE CS Press, Los Alamitos (1985)Google Scholar
  3. 3.
    Granlund, T.: GNU MP: The GNU Multiple Precision Arithmetic Library, 4.1.2 edn. (2002),
  4. 4.
    Knuth, D.: The analysis of algorithms. Actes du Congrès International des Mathématiciens de 3, 269–274 (1970); Gauthiers-Villars, Paris ( 1971)Google Scholar
  5. 5.
    Montgomery, P.L.: Modular multiplication without trial division. Math. Comp. 44(170), 519–521 (1985)zbMATHMathSciNetCrossRefGoogle Scholar
  6. 6.
    Schönhage, A.: Schnelle Berechnung von Kettenbruchentwicklungen. Acta Informatica 1, 139–144 (1971)zbMATHCrossRefGoogle Scholar
  7. 7.
    Schönhage, A., Strassen, V.: Schnelle Multiplikation grosser Zahlen. Computing 7, 281–292 (1971)zbMATHCrossRefGoogle Scholar
  8. 8.
    Shand, M., Vuillemin, J.E.: Fast implementations of RSA cryptography. In: Swartzlander, E.E., Irwin, M.J., Jullien, J. (eds.) Proceedings of the 11th IEEE Symposium on Computer Arithmetic (ARITH-11), pp. 252–259. IEEE Computer Society Press, Los Alamitos (1993)CrossRefGoogle Scholar
  9. 9.
    Vallée, B.: Gauss’ algorithm revisited. Journal of Algorithms 12, 556–572 (1991)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Vallée, B.: Dynamical analysis of a class of Euclidean algorithms. Th. Computer Science 297(1-3), 447–486 (2003)zbMATHCrossRefGoogle Scholar
  11. 11.
    von zur Gathen, J., Gerhard, J.: Modern Computer Algebra, 2nd edn. Cambridge University Press, Cambridge (2003)zbMATHGoogle Scholar
  12. 12.
    Yap, C.K.: Fundamental Problems in Algorithmic Algebra. Oxford University Press, Oxford (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Damien Stehlé
    • 1
  • Paul Zimmermann
    • 1
  1. 1.LORIA/INRIA LorraineVillers-lès-NancyFrance

Personalised recommendations