bezout.py

Created by christian-mercat

Created on April 18, 2024

980 Bytes

On donne deux entiers (a,b), la fonction retourne (u,v,d) tels que au+bv=d est le PGCD de a et b.

bezout(287,129) renvoie (-40,89,1) car -40×287+89×129=1, ils sont premiers entre eux. Pour information, deux autres versions, une par soustraction et une autre, sans appel récursif et plus compréhensible: à chaque étape du calcul d’Euclide des restes des divisions successives.


During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.