0

I'm not sure this is the right place to ask, but here goes anyway.

Background, if you're interested

I've written some pretty fast C code that can accept an ordered list of loans (with current balances, terms, and rates) and will calculate minimum payments for me. Not only this, but it will also calculate an amortization table that

  1. can accept an extra monthly payment to principle and
  2. will snowball the minimum payments of paid-off loans into that extra monthly payment.

I'm now challenged with the task of ordering the loans correctly. Going through every possible combination would take O(nn) time (that is, if I have 20 loans, there are 2020 permutations that I have to check if I wanted to check them all). If you want a chuckle, it would take about six times the age of the universe to do it this way.

Clearly, this is not a viable option. I attempted to use the debt-snowball / debt-avalanche methods to determine ordering, but these also appear to not always give the best orderings.

At the moment, I've no better approach than running many thousands (recently ≈25000) of random trials and seeing which loan-orders give the best results (i.e., take the least amount of time total to pay off).

Is there a good way to determine which loan would be most advantageous to pay off first in terms of months spent paying them off?

For each loan, I've only got the current balance, the interest rate, and the term of the loan (and thus the minimum payment). For the entire loan collection, I have a single extra payment to principle that I'll apply to one loan at a time (letting it snowball). Can I derive an optimal payoff-order of the loans from this information? Is there some other information I could derive and then use? (Is paying off one loan at a time even the best approach?)

4
  • 3
    Well, no. It's 20! That's how many ways one can order 20 different items. About 2.4 x 10E18. But even then, this is all nonsense as it's not rocket science to pay highest rate first. That's it. Sep 18, 2017 at 2:48
  • If you want to improve your algorithm you should post the question on a CS-related site, I guess
    – Philipp
    Sep 22, 2017 at 6:39
  • @Philipp I disagree; a financial algorithm takes financial expertise to formulate. I wouldn't go to a career mathematician for a recipe. Sep 22, 2017 at 12:22
  • I have written something about it with calculations if you want some numbers github.com/SiloCityLabs/loanPay
    – ldrrp
    Aug 30, 2019 at 16:59

1 Answer 1

8

The simple answer is that, terms and conditions of the loans otherwise being equal, it is best to pay the highest interest rate loans off first.

3
  • As mentioned above, I've already determined (by observation) that this is not always the case. Using this method does indeed result in paying less interest and that would seem to imply it's always more advantageous to pay off more expensive debts first, but the evidence does not completely bear that out (unless there's a bug in my code somewhere). Sep 17, 2017 at 6:51
  • 5
    @SeanAllred Do you have a specific example where this is not the case. Paying highest interest first is different than the debt snowball where you may favor paying off a smaller, lower interest balance first.
    – Eric
    Sep 17, 2017 at 6:55
  • 1
    Whelp, I spoke too soon! Seems there's a bug in my code somewhere. It shouldn't be shuffling the first run, but alas, somehow it is. (By the way, it's probably unfortunate that both the snowball and avalanche methods still 'snowball' the minimum payments; it causes for some confusion in communication.) Sep 17, 2017 at 7:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .