NAME

examples/pir/euclid.pir - Euclid's algorithm

SYNOPSIS

    % ./parrot examples/pir/euclid.pir

DESCRIPTION

Implements Euclid's algorithm (http://www.cut-the-knot.org/blue/Euclid.shtml) and uses it to compute gcd(96,64).

Knuth, Donald E. The Art of Computer Programming Volume 1: Fundamental Algorithms. Third Edition. Section 1.1 Algorithm E (Euclid's algorithm) Page 2:

    I1: m
    I2: n
    I4: r

    E1: Find remainder.
    E2: Is it zero?
    E3: Reduce.