What @tenmiles says is correct. I would make two modifications to make this more useful (which is what I played with before). Note: you have to look up the angle of view (various web sites or the manufacturers' sites).
First, since you want the same "view" from both lens, you are indicating the distance (d2) where h is the same as it is with the other lens. For that part, instead of using h/2, you can just use "w", implying 1/2 of the width of angle of view for a spscific distance.
Second, I'd solve the equation, so that it is in terms of d1 and d2. So...
w/d1 = tan(angle1/2), and w/d2 = tan(angle2/2)
w = d2 * tan(angle2/2) and w = d1 * tan(angle1/2)
These are equal, so:
d2 * tan(angle2/2) = d1 * tan(angle1/2)
In other words:
d2 = d1 * tan(angle1/2) / tan(angle2/2)
You can calculate (once), the tangents, so that you have d2 in terms of some constant times d1. Then, you can use a spreadsheet and plug in d1 and see what d2 comes out to. I did this for two lenses I had and found that what I'd shoot at 10' with one, I'd need to be at 14' for the other, etc.