Рекурсивно:
function monthly(a, b, n) {
const result = a * b / 12;
console.log("%f * %f / 12 = %f", a, b, result);
if (n) return monthly(a + result, b, n - 1);
else return result;
}
monthly(1e6, 0.15, 12);
консоль1000000.000000 * 0.150000 / 12 = 12500.000000
1012500.000000 * 0.150000 / 12 = 12656.250000
1025156.250000 * 0.150000 / 12 = 12814.453125
1037970.703125 * 0.150000 / 12 = 12974.633789
1050945.336914 * 0.150000 / 12 = 13136.816711
1064082.153625 * 0.150000 / 12 = 13301.026920
1077383.180546 * 0.150000 / 12 = 13467.289757
1090850.470303 * 0.150000 / 12 = 13635.630879
1104486.101181 * 0.150000 / 12 = 13806.076265
1118292.177446 * 0.150000 / 12 = 13978.652218
1132270.829664 * 0.150000 / 12 = 14153.385371
1146424.215035 * 0.150000 / 12 = 14330.302688
1160754.517723 * 0.150000 / 12 = 14509.431472