The expected number of tests until failure is 1/p(failure).
In this case, p(failure) = (AC - Attack Bonus - 1) / 20, with an upper limit of 95% and a lower limit of 5% because 1's always miss and 20's always hit.
So, if AC and Attack Bonus are reasonably related (that is, not 20 or further...