solving for time on a student loan with a given monthly payment I am trying to calculate the amount of time it will take for me to pay off my student loan with a fixed monthly payment amount. I have been trying to solve this problem for a few days now to no avail. Using the information i have gathered from the internet and the various calculators online for calculating the monthly payment. I cant figure out the formula that is being used. Everywhere it states that student loans are simple interest but it seems like this is not the full truth.
So far iv been able to get "close" to the numbers that they provide by using this formula.
                       A = P ( (r/365) * (Q * (t*365) ) )
          Simplified   A = P (rQt)
          Total amount for t years = A + P
          Solve for t  t = PrQ/A

where:
A = monthly payment
P = principle
r = percent/100
t = time in years or * 12 for months
Q = (2.729/5)*365t ~= 199.219 which has something to do with the amount of days you attend a year of schooling but from my research this number varies very slightly based on time and rate. This includes fall semester, spring semester, winter semester, and summer semester but excludes days off. My thinking is because this loan is given out specifically for those time periods only and not to be used throughout a full 365 days like an auto loan.
So my question is what is the equation for calculating how long it will take to pay off a student loan with (P) amount, (r) interest and (A) monthly payment amount? It seems as though this will not be an algebraic equation but a calculus one instead. Here is one the calculators i have used so far out of maybe 10 https://smartasset.com/student-loans/student-loan-calculator
 A: I don´t know what you mean by $ Q$. I will use the numbers which are mentioned the website you´ve posted. But first of all I solve the general formula for the time ($n$).
$$L\cdot\left( \left( 1+\frac{i}{m}\right)^{m}\right)^n=p\cdot \frac{\left(\left(1+\frac{i}{m}\right)^{m}\right)^n-1}{\frac{i}{m}}$$
$L$ is the loan amount. $p$ is the regular payment. $i$ is the yearly interest rate. $n$ is the number of years.
$m$ divides the year in $m$ equal parts. If the payment is made and compunded $\color{orange}{\textrm{monthly}}$ ($\color{blue}{\textrm{daily}}$, $\color{green}{\textrm{semi-annually}}$, $\color{red}{\textrm{yearly}}$) then $m$ is $\color{orange}{\textrm{12}}$ ($\color{blue}{\textrm{365}}$, $\color{green}{\textrm{2}}$, $\color{red}{\textrm{1}}$)
Dividing the equation by $p$ and multiplying it by $\frac{i}{m}$
$$\frac{L}{p}\cdot \frac{i}{m}\cdot \left( \left( 1+\frac{i}{m}\right)^{m}\right)^n= \left(\left(1+\frac{i}{m}\right)^{m}\right)^n-1$$
Adding $1$ and subtracting the whole left side.
$$1= \left(\left(1+\frac{i}{m}\right)^{m}\right)^n-\frac{L}{p}\cdot \frac{i}{m}\cdot \left( \left( 1+\frac{i}{m}\right)^{m}\right)^n$$
Factoring out the term in the brackets.
$$1= \left(\left(1+\frac{i}{m}\right)^{m}\right)^n\cdot \left( 1-\frac{L}{p}\cdot \frac{i}{m}\right)$$
$$\frac1{ 1-\frac{L}{p}\cdot \frac{i}{m}}= \left(\left(1+\frac{i}{m}\right)^{m}\right)^n $$
Taking logs. I use the logarithm naturalis here, which is based on $e$.  But you can take other logarithms as well.
$$\ln\left(\frac1{ 1-\frac{L}{p}\cdot \frac{i}{m}}\right)=\ln\left(\left(\left(1+\frac{i}{m}\right)^{m}\right)^n\right)$$
The exponent n can be put infront of the $\ln$-function, due logarithm rule $\ln(a^n)=n\cdot \ln(a)$
$$\ln\left(\frac1{ 1-\frac{L}{p}\cdot \frac{i}{m}}\right)=n\cdot \ln\left(\left(1+\frac{i}{m}\right)^{m}\right)$$
For the left side we can use that $\ln\left(\frac1a\right)=-\ln(a)$
$$-\ln\left( 1-\frac{L}{p}\cdot \frac{i}{m}\right)=n\cdot \ln\left(\left(1+\frac{i}{m}\right)^{m}\right)$$
$$n=\frac{-\ln\left( 1-\frac{L}{p}\cdot \frac{i}{m}\right)}{\ln\left(\left(1+\frac{i}{m}\right)^{m}\right)}=-\frac{\ln\left( 1-\frac{L}{p}\cdot \frac{i}{m}\right)}{m\cdot\ln\left(1+\frac{i}{m}\right)}$$
The given numbers of the linked site $L=28400, p=297, m=\color{orange}{\textrm{12}}$ and $i=0.0466$ we obtain
$$n=-\frac{\ln\left( 1-\frac{28400}{297}\cdot \frac{0.0466}{12}\right)}{12\cdot\ln\left(1+\frac{0.0466}{12}\right)}=9.97979 \approx 10$$
Remark
At the calculator the payment of $p=297$ has been rounded to dollars, without cents. I have calculated with the formula above a payment of $296.528$. See here the equation and the result. If I use this value of $p$ the result for $n$ is even more closer to $10$. Nevertheless $n$ must be an integer.
