function ggd(a,b) a = abs(a) b = abs(b) if a = 0 then ggd = b else if b = 0 then ggd = a else if a > b then ggd = ggd(b, a mod b) else ggd = ggd(a, b mod a) end if end if end if end function function kgv(a,b) kgv=a*b/ggd(a,b) end function