This is math, and math is evil - or at least that is what I got out of school thinking whilst barely skating through by the skin of my teeth in high school algebra. mind you, this is decades ago...
Anyhow, there is no such function in AGC, but I whipped one up. All credits to Wikipedia who had a code example written in what appears to be a Pascal or Modula2 inspired pseudo-code.
do
print(str(gcd(64, 24)))
sync()
loop
function gcd(high as integer, low as integer)
counter = 0
while mod(high, 2) = 0 and mod(low, 2) = 0
high = high / 2
low = low / 2
inc counter
endwhile
while high <> low
if mod(high, 2) = 0
high = high / 2
elseif mod(low, 2) = 0
low = low / 2
elseif high > low
high = (high - low) / 2
else
low = (low - high) / 2
endif
endwhile
gcdenom = round(high * pow(2, counter))
endfunction gcdenom
I tested it with a few numbers, and it seems allright.