Let the original numbers be "a" and "b", the divisor be "d", and the equal remainder be "r". Then, by definition of division, etc, we get:

a = md + r

b = nd + r

(The "m" and "n" will be the answers across the top of the long division, the part that "d" went "evenly" into. This is like "thirteen divided by four has a remainder of one" can also be written as "13 = 3*4 + 1".)