%

Formula

N = [ log ( 1 + [ ( r*F ) / P ] ) ] / ( log (1+r) )

Where,
P = Payment Amount
F = Future Amount
r = Rate of Interest (compounded)
N = Number of Payments

Rate of Interest Compounded is,
If Monthly,
r = i / 1200

If Quarterly,
r = i / 400

If Half yearly,
r = i / 200

If Yearly,
r = i / 100