If w have a factor and we want to get the largest unit factor less than it, Why we use this equation to get the least denominator: (numerator+denominator-1/numerator) ? I don't understand it
(den+num-1) / num = (den - 1)/num + 1
in integer division gives the next largest integer to the ratio den/num
. Note that when this ratio is already an integer, i.e., den
is an integer multiple of num
, then the formula returns exactly this integer.
That is, this formula is the (always exact) integer variant of the floating point formula
fceil(den/(double)num)