How to put this problem into equation? I start with a value A. I decrease it by M each month m. Every year (ie, m mod 12 =0), I calculate the average of what A has been throughout the year, multiply that by t, and add it to A. This goes on until A reaches 0 (t and M are set in such a way that A decreases every year). How many months m would that take ?
Similarly, given A and M, if I want A to reach 0 after m months, what does the value of t need to be ?
In other words, I have a capital A that has been given to me by a bank B1. B1 asks me to return M dollars every month, until it reaches a value N that was predefined by B1 (B1 also calculates this in terms of a interest percentage, but I don't understand the definition of that interest value). I put the money A that B1 gave me into a bank B2. What does the yearly interest t in bank B2 need to be so that it is the threshold between winning and losing money ?
These may seem like 3 different questions, but I think that once put into equation, I think it's easy to answer all of these by just expressing one variable as a function of others.
concrete example:
I ask a bank B1 to lend me A=10,000 dollars. In exchange for that 'donation', B1 wants me to give M=100 dollars for 10 years (m=120). In the end, as you can see, I end up giving more (12000 dollars) than I was given. However, I do not plan to use these 10,000 dollars. Instead, I just put it into a bank B2 and wait for interest rates to inflate my money. If don't know how this is done in your country, but in mine, I think the interest rates are given at the end of the year, but calculated monthly (I think that one other way to say that is to say that it is calculated yearly, but with the average of what you had in your balance throughout the year, hence my explanation in the first paragraph). Interests over interests don't apply monthly, but yearly. This is to say that if you have 100 dollars the first year, with an interest rate of 2%, then the second year you have 100+2, but the third you have  100*1.02*1.02=1.0404 instead of just 100+2+2=104. So if I could have these 10,000 dollars for 10 years, I would have 10000*t^(m/12). But I don't have A=10000 dollars for 10 years, because they keep decreasing as I have to give M=100 dollars away every month. So first of all, I'm trying to find a formula (not a estimate by excel, but an exact mathematical formula) that says what is my balance after m months. Then I'm trying to find what value t (the interest rate from bank B2) needs to be (depending on the value of M) so that I end up winning money by asking B1 to give me money and placing this money into B2.
 A: Writing the equation is following what you have written, but there are a few details not perfectly specified.  Let $B(m)$ be the balance owing to the first bank in month $m$.  The first sentence tells us that $B(0)=A$.  Then you say that $B(m)=B(m-1)-M$ unless $m$ is a multiple of $12$.  It is not clear what values are averaged for the yearly increment, but it looks like we should average B(0) through B(11).  Do you also decrement by M in month 12?  It would seem that $B(12)=B(11)-M+\frac t{12}\sum_{i=0}^{11}B(i)$.  Then we go back to $B(m)=B(m-1)-M$ until month $24$, when $B(24)=B(23)-M+\frac t{12}\sum_{i=12}^{23}B(i)$ and so on.  Presumably you deposit the A in the second bank.  You are using $t$ for a constant in the bank B1 equation as well as the interest paid by bank B2.  Do you know that they will be the same?  Probably not, so I will use $s$ as the annual interest paid by B2 and assume that it is compounded monthly.  Then let $C(m)$ be the balance in B2.  We have $C(0)=A, C(m)=C(m-1)(1+\frac s{12})-M$.  Your net position at any month is $C(m)-B(m)$.  This is made for a spreadsheet-make columns for $m, B(m), C(m), C(m)-B(m)$ with $t,s$ in cells you reference by name or by fixed reference (Excel uses dollar signs).  Given $A, M, t$, you can look to find the month you pay off the loan.  Then Excel will let you goal seek to make the balance zero by changing $s$.  If you use a spreadsheet without that capability, you can just do it by hand, looking for the correct $s$.
