For the lower bound, you get that when a > 1. Then x starts at a instead of at 1, so you need fewer iterations to get from there to b.
If you start with x = a, and the last iteration happens when x = b (you fail the test), then you needed a total of b - a iterations. Since b <= bmax, the answer is:
lower bound : bmax - a
upper bound : bmax - 1
Note that if a >= bmax, the lower bound reduces to 0, as you cannot have fewer than 0 iterations.