%%HP: T(3)A(D)F(.);
@ by Joe Horn
DIR
  PYTH @ x,y -> { A B C }.
    \<< DUP2
      IF <
      THEN SWAP
      END R\->C SQ DUP ABS SWAP C\->R ROT 3 \->LIST
    \>>
  GCD  @ Greatest Common Divisor; x,y -> gcd.
    \<<
      WHILE OVER MOD SWAP DUP
      REPEAT
      END DROP
    \>>
  LCM @ Least Common Multiple; x,y -> lcm.
    \<< DUP2 GCD / *
    \>>
  RDC @ Reduce; x1,y1 -> x2,y2.
    \<< R\->C DUP C\->R GCD / C\->R
    \>>
END
