I am struggling to understand the formula for compound interest. More specifically what the $n$ stands for.
The formula is as follows according to the wikipedia: $$ A = P(1 + \frac{r}{n})^{nt} $$
Where
$A$ = final amount
$P$ = initial principal balance (money invested)
$r$ = interest rate
$n$ = number of times interest applied per time period
$t$ = number of time periods elapsed
But we can twist the parameters so that the interest is not $r$.
Let's take an example: annual interest rate of 20%, compounded quarterly. This means that the parameters are $t = 1$ year, $r = 20$%, $n = 4$
If I invest 1 USD for a year ($P = 1$) it should be 1.20 USD at the end of the year by the definition of annual interest rate, but based on the formula, I calculate something different: The annual interest rate is $21.55$%, because by investing 1 USD, I will have earned 1.2155 USD by the end of the year.
$$ A = 1(1 + \frac{0.2}{4})^{4 \cdot 1} = 1.21550625 $$ Which is approximately 21.55%, not 20% annually.
The continuous compounding interest is derived from this formula, so I would like to understand this before understanding that.