Answers for "extended euclidean algorithm"

C++
3

extended euclidean python

def extendEuclidean(a, b, s1=1, s2=0, t1=0, t2=1):
    
    if b:
        r=a%b
        return extendEuclidean(b, r, s2, s1-s2*(a//b), t2, t1-t2*(a//b))
    
    return a, s1, t1
Posted by: Guest on November-05-2020
1

extended euclidean algorithm

int gcd(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    int x1, y1;
    int d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}
Posted by: Guest on December-23-2020

Code answers related to "extended euclidean algorithm"

Browse Popular Code Answers by Language