# How can I find the the greatest common divisor with Euclid's algorithm?

How can I create a function ggt[p,q],and find the greatest common divisor with Euclid's algorithm?p,q are integer.

• May we assume that you are already familiar with GCD[n1, n2,...]'? Feb 19 '17 at 20:22
• I think I only knew a little about GCD[n1, n2,...]' Feb 19 '17 at 20:28

ggt[p_, q_] := First[NestWhile[{Last[#], Mod @@ #} &, {p, q}, Last[#] != 0 &]]