Yes and no.
If the monotonic function does not converge to a finite value - than yes, you could use binary search as follows:
i <- 1
while (f(i) > target):
i <- i*2
binary search for target in the range `[2^(i-1),2^i]` for best candidate.
Complexity of the above is O(log(i))
- where i
is the index of the closest element.
Note however, that if the function converges to some constant value, all bets are off.
For example, it won't help you to find the closest value to -1
for the function f(i) = 1/i
. In this case, thew algorithm will be in an infinite loop.