a*T[0]+b*T[1]=T[2], T[2]=gcd
1 import std.numeric : gcd; 2 foreach (i; 0..100) { 3 foreach (j; 0..100) { 4 auto e = extGcd(i, j); 5 assert(e[2] == gcd(i, j)); 6 assert(e[0] * i + e[1] * j == e[2]); 7 } 8 }
See Implementation
a*T[0]+b*T[1]=T[2], T[2]=gcd