The formula
Payment = (Cost โ Residual รท (1 + r)^n) ร r รท (1 โ (1 + r)^โn)r is the monthly rate and n the number of months. For payments in advance, the result is divided by (1 + r).
Comparing with a loan? See the Business Loan Calculator. For cars, the Car Lease Calculator uses the dealer money-factor method.