Euclid’s coefficients
The following program is based on Euclid’s algorithm and it determines Euclid’s coefficients and of the integers and .
INPUT , (positive integers)
,
,
,
WHILE DO
BEGIN
DIV (integer division)
, ,
, ,
, ,
END
WRITE — The gcd of the numbers and is .
Remark. The values of and produced by the program have the absolute values![]()
as close each other as possible (Proof = ?). They differ very often only by 1 when and are two successive prime numbers
![]()
, e.g.
| Title | Euclid’s coefficients |
|---|---|
| Canonical name | EuclidsCoefficients |
| Date of creation | 2013-03-22 15:15:20 |
| Last modified on | 2013-03-22 15:15:20 |
| Owner | pahio (2872) |
| Last modified by | pahio (2872) |
| Numerical id | 16 |
| Author | pahio (2872) |
| Entry type | Algorithm |
| Classification | msc 11A05 |
| Classification | msc 03-04 |
| Related topic | BezoutsLemma |