My first question on math stackexchange.
I have two numbers, $n$ and $m$. Their values will vary but I always know what they are and they're always positive integers (and multiples of 2, but that doesn't make much difference).
I want to find the smallest number both $n$ and $m$ will perfectly divide into.
E.g.$\begin{align*}n&=32\\m&=144\end{align*}$
Smallest number they will both divide into is $288$.
I can see how to work this out iteratively ($n*m$, then keep dividing by 2 until you find the first number they both won't divide into, the previous value is the desired value) but I can't see how to calculate it directly (and I need to).
For those who ae wondering what this is for, it's do with memory allocation on an ARM platform. I want to be cache line aligned and also exclusive reservation granuale aligned. There, that helped ;-)
So if the cache line width is 32 bytes and the ERG is 144 bytes, I want to allocate with alignment on 288 bytes.
What it amounts to is this; $nx - my = 0$
Except that defines many values and I want the smallest value of $nx$ and $my$ where this is true. $\begin{align*} nx &= my\\ \frac{nx}{ my} &= 1\\ \left(\frac{n}{m}\right)\left(\frac{x}{y}\right) &= 1 \end{align*}$ I know $n$ and $m$, so $\frac{n}{m} = c$ $\frac{x}{y}=c$
And I see that somewhere I need to find more information because what I have can't solve the question. I can't see how to quantify my wish for the smallest values into the equation.