Arghh... I think thats the right name for it! Does anyone know of an easy way to find the lowest common factor between two integers? Like the lowest common factor of 6 and 8 is 24. I'm writing a fractions class that when it adds and subtracts needs to find the lowest common factor of the denominators. I know I could do:
but this seems very inefficient. From my math days I remember one multiplies all the factors the two numbers don't have in common, but I really think that would be too hard to write code for. Anyone know of more efficient way?Code:counter=greater(x,y); while (counter%x || counter%y) counter++;