# How do I solve for n (number of periods) in a loan repayment formula?

Where

• A = payment Amount per period
• P = initial Principal (loan amount)
• r = interest rate per period
• n = total number of payments or periods

How can I rearrange the formula to solve for n?

• Have you tried logarithms? – SK19 Apr 13 at 6:26

$$A = P \frac{r(1+r)^n}{(1+r)^n -1} \Rightarrow$$

$$A [(1+r)^n -1]= rP (1+r)^n \Rightarrow$$

$$(A-rP)(1+r)^n = A \Rightarrow$$

$$(1+r)^n = \frac{A}{A-rP}\Rightarrow$$

$$n = \log_{1+r} (\frac{A}{A-rP})$$

• Thank you that is working great. I'm using this for a personal budget so that's all I need and I'm able to implement this now. However I don't completely understand how you got from step 2 to step 3 and I am curious. If possible could you elaborate on this? – Caleb Macdonald Black Apr 13 at 7:11
• @CalebMacdonaldBlack Step1: multiply left and right by $(1+r)^n -1$; step2: bring things from the right to the left and then bring the $-A$ to the right; step3: divide left and right by $A-rP$; step4: take the logarithm on left and right; where do you want an explanation? – dcolazin Apr 13 at 7:15