Clever way to find zero remainder with decreasing divisor

116 Views Asked by At

I need to factorize a number starting from an initial divisor and going down by $1$ at each step. For example, starting from $99$ and decreasing it one by one

$$9779 = 99 \times 98 + 77$$ $$9779 = 98 \times 99 + 77$$ $$9779 = 97 \times 100 + 79$$ $$\vdots$$ $$9779 = 77 \times 127 + 0$$

I reach the zero remainder after $23$ steps.

I was wondering if there is a clever way to "predict" the first null remainder given the first division(s). I saw this question but mine has a particular pattern so maybe there is a better solution than brute force.

Thanks a lot