Yesterday, nobody contributed anything.  :-(
The official answer is: log2(1 - abs(1 / floor(x) - 1 / (x + 1)))