title: Find the end of a ascending series with minimum query
body: <p>Suppose there is an ascending positive integer series, and the intervals between any 2 adjacent integers follow a distribution, for example, </p>
  
  <p>[5, 6, 11, 23, 24, 33, ...], where <img src="https://chart.googleapis.com/chart?cht=tx&amp;chl=x_i%20%5Cin%20%5Bmin%2C%20max%5D" alt="f1">, <img src="https://latex.codecogs.com/gif.latex?x_i-x_%7Bi-1%7D%5Csim%20Geo%28p%29" alt="f2"></p>
  
  <p><em>(Geometric distribution is the discrete version of exponential distribution)</em>  </p>
  
  <p><strong>Query(x)</strong> could be made to check whether x is in this series. We already know <strong>min</strong>, <strong>max</strong>, <strong>p</strong>. </p>
  
  <p>The problem is how to find the <strong>end</strong> (last x) of this series, with few <strong>queries</strong> as possible. </p>
  
  <hr>
  
  <p>For example, min = 1, max = 10000, p = 0.15</p>
  
  <p>The first idea I came with is <strong>binary search</strong>, however, since the interval of adjacent integers is not sure. I may select the 99th quantile, 30, as the maximum interval I believe, and during each search in the binary search, I would consecutively query 30 successive integers. In this case, the first batch of queries I made is (query(5000), query(5001),..., query(5030))</p>
  
  <p>I think this method is somewhat inefficient(slow), and there is a small probability that interval exceed 30, which cannot guarantee the binary search can find the <strong>end</strong> correctly. </p>
  
  <hr>
  
  <p><em>PS:
  It's my first time asking a question on StackOverflow. I'm sorry if I didn't state my question clear. Feel free to give me any suggestion and I will edit the question.</em>  </p>