I'm making some AutoHotkey scripts and need to reduce a fraction.
Can anyone help me find the most efficient way to find the highest common denominator between 2 numbers?
I figure I can do a brute force type thing where I make each number "numerator1" and "numerator2".
Take each numerator and divide it by a counter.
- If the results for each division are integers then I'd make the results the new numerators.
- If one of the results is not an integer then increase the counter over and over until the counter = the smaller of the numerators
But I figure there's probably a better way...