tinycodinglm / math /math-0165.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
740 Bytes
opencode trace
System You are an expert mathematician and programmer.

You are an expert mathematician and programmer.

User

Explain GCD algorithms and applications

Assistant

Euclidean: gcd(a,b) = gcd(b, a mod b). O(log(min(a,b))).

Extended Euclidean: find x,y with ax+by=gcd(a,b). Base: a1+b0=a when b=0. Recursive back-substitution.

LCM: a/gcd(a,b)*b.

Applications: modular inverse (ax+my=1), Diophantine equations (ax+by=c solvable iff gcd(a,b)|c), Bezout identity, coprimality check, fraction simplification.