# Paste: Euclidean gcd-by-division

Author: | Loryn |

Mode: | factor |

Date: | Wed, 8 Apr 2009 10:51:27 |

Plain Text |

In learning Factor, I implemented the following pseudocode in Factor.
Psuedocode
function gcd(a, b)
while b ≠ 0
t := b
b := a mod b
a := t
return a
Factor
: gcd-by-division
[ dup zero? ]
[ tuck mod ] until
drop ;

## New Annotation