I n the problem Loan Repayment, I have found potentially a faster way to check if an integer x is viable (in theoretical O(1) time) thus speeding up the entire solution from O(sqrt(n) * log n) to O(log n).

However, I couldn’t quite get my solution to work and was wondering if someone on here would be willing to help out or let me know if this is a dead end.

My method is described here: https://admiring-poitras-f4ec43.netlify.app/loan.