Sounds like a job for Excel. Create two scenarios - include payments to 401k, return on 401k balance, payments to loan, and interest on loan balance running them out until the loan is paid and see what you have in your 401k. Then do it again over the same total period but with all payments going only to your loan…