This is similar to a binary search algorithm, which you can find good examples on for .NET.

Remember, if you are dealing with continuous compound interest, then:

{future value} = {present value} * e^({annual interest rate}*{number of years})

Therefore, you can rearrange the formula to solve for different values, such as the present value or interest rate given the other values.

e.g., {present value} = {future value} / e^({annual interest rate}*{number of years})

{annual interest rate} = ln({future value}/{present value}) / {number of years}

Where ln() is the natural logarithm.

Similarly, you can do the same for periodic compound interest:

{future value} = {present value} * (1 + {annual interest rate}/{periods per year})^({periods per year}*{number of years})

Regarding the pseudo code, here is my interpretation.

(1) obtain known values of above formula, including the amount of future values and the specific time period.

(2) initialize minimum and maximum values of i.

(3) repeat binary chop algorithm where you try "i" at the midpoint of min/max. I read this as you pass "i" to present value function with the values of advances/installments. If you have the correct APR, the present value of the amount paid out should equal the present value of the amount paid in if I understand correctly. If installments are higher, you move to upper half of "i"; if lower, the bottom half.

You iterate until the difference between the min/max approaches zero:

Do While ((max - min) < 0.0000001)

...

Loop

Does that help?