There is no formula to answer the question. You have to balance return on investment with risk. There's also the question of whether you have any children or other heirs that you would like to leave money to.
The mortgage is presumably a guaranteed thing: you know exactly how much the payments will be for the rest of the loan.
I think most annuities have a fixed rate of return, but they terminate when you both die. There are annuities with a variable return, but usually with a guaranteed minimum.
So if you got an annuity with a fixed 3.85% return, and you lived exactly 18 more years, then (ignoring tax implications), there'd be no practical difference between the two choices. If you lived longer than 18 years, the annuity would be better. If less, paying off the mortgage would be better.
Another option to consider is doing neither, but keeping the money in the 401k or some other investment. This will usually give better than 3.85% return, and the principal will be available to leave to your heirs. The big drawback to this is risk: investments in the stock market and the like usually do better than 3 or 4%, but not always, and sometimes they lose money.
Earlier I said "ignoring tax implications". Of course that can be a significant factor. Mortgages get special tax treatment, so the effective interest rate on a mortgage is less than the nominal rate. 401ks also get special tax treatment. So this complicates up calculations trying to compare. I can't give definitive numbers without knowing the returns you might get on an annuity and your tax situation.