namespace Gcd { public class PairWithGcdRR : PairWithGcdR { public PairWithGcdRR (int p, int q) { Set(p, q); } public override int Gcd () { if (q == 0) { return System.Math.Abs(p); } else { PairWithGcdR next = new PairWithGcdRR(q, p % q); return next.Gcd(); } } } }