You are given a function F, which maps non-negative integers to non-negative integers. You know that F is monotonically increasing: if x > y, then F(x) > F(y).
Write code which given such a function F, and an integer y, quickly finds the value x such that | F(x) - y | is minimized.