function lcm(a, b: Integer): Integer; begin if a < b then Swap(a, b); lcm := a; while lcm mod b > 0 do Inc(lcm, a); end;