Calculating loan + interest recursively I am trying to calculate a loan amount where the total principle depends on the payment amount.
Here's a simple example, leaving aside that a) no bank would actually do this, and b) my income is not specified:
I have $0 in the bank right now. I want to take out a loan for a $100 car, for which I will be making a regular annual payment, starting at the end of year 0 with an interest-only payment. My loan rate is 5%. In order to qualify for the loan, the bank wants to make sure that I have a balance equal to twice my annual payment amount throughout the life of the loan.
If I borrow exactly $100, my payment at the end of year 0 would be $5 ($100 x 5%). However, I need to borrow a little extra so that I have a $10 balance in the account (to satisfy the requirement that I maintain a balance of twice my annual payment). This means I actually need a loan of $110. However, a loan of $110 actually raises my payment amount to $5.50, which means I need to maintain a balance of $11 in my account.
This means that I actually need to borrow $111 to begin with, which raises my payment to $5.55, which means I actually need to borrow $111.10, etc.
I have worked it out to a summation that resembles the following, although I can't be certain this is accurate:
$$\sum_{n=1}^x (x-1-n)r^n$$
Where $r$ is the interest rate
I believe this would allow for me to iterate $x$ number of times over a formula that sums the additional principle needed for each incremental amount of interest. However, I'm not sure how to carry this out to infinity.
Ultimately, I need to plug this into Excel as part of a cash flow, but I wanted to think through the math first.
Any ideas?
 A: In the Wikipedia article you link to, cash on hand does not increase the DSCR.  Unless the cash generates income, borrowing more lowers the DSCR by the ratio of the new payment to the old payment.  If the cash can generate income greater than the old DSCR times the payment, borrowing will help the DSCR.  The new income enters into the Annual Net Income term.
If I inherit a bunch of money, but deposit it at zero interest, my DSCR doesn't change.  Paying down the loan in a way that lowers the payment would help.
A: Rearrange summation into simpler terms:
$$\sum_{n=1}^x (x-1-n)r^n$$
$$\sum_{n=1}^x (x - 1)r^n - \sum_{n=1}^x nr^n$$
$$(x - 1)\sum_{n=1}^xr^n - \sum_{n=1}^x nr^n$$
Carry out to infinity, as you ask:
$$\lim_{x\to\infty}\left[(x - 1)\sum_{n=1}^xr^n - \sum_{n=1}^x nr^n\right]$$
Now we look here for the closed forms of these finite sum series.
$$\lim_{x\to\infty}\left[(x - 1)\left(\frac{1 - r^{x+1}}{1 - r} - 1\right) - r\frac{1-(x+1)r^x+xr^{x+1}}{(1-r)^2}\right]$$
But unfortunately, it looks like this won't converge to a limit. Since $0 \leq r < 1$, the $r^x$ and $r^{x+1}$ factors vanish and we are left with:
$$\lim_{x\to\infty}\left[(x - 1)\left(\frac{1}{1 - r} - 1\right) - r\frac{1}{(1-r)^2}\right]$$
This is just $Ax + B$ which has no limit as $x$ grows large.
But maybe the above ideas hint you in the direction of finding a closed form for your calculation so that you can avoid iterating or recursing.
A: Assuming that I finally understood the problem correctly, the math is as follows.
Let $M$ be the money you need to spend, $L$ be the money borrowed, $r$ the monthly interest rate, $K$ the ratio of the required balance to the monthly payment.
Your monthly payment (interest only) is $Lr$. You need to have the balance $KLr$ (which you never touch). You have nothing now and have to spend $M$ right away. The leftover from the loan is $L-M$, so we must have $L-M=KLr$, i.e., $L=M/(1-Kr)$.
Of course, this works under the assumptions I described. Other strategies may result in a different answer.
