Binary search ("bisect") tool
Python, 64 chars
 
This one is recursive, so will overflow the stack for really large input
01234567890123456789012345678901234567890123456789012345678901234567890
|         |         |         |         |         |         |         |
 B=lambda L,H:H&gt;L+1 and B(*[L,L/2+H/2,H][test(L/2+H/2):][:2])or H

test run
def test(n):
    print &quot;testing &quot;, n
    return n&lt;66

L,H=10,1000


B=lambda L,H:H&gt;L+1 and B(*[L,L/2+H/2,H][test(L/2+H/2):][:2])or H

print B(L,H)

outputs
testing  505
testing  257
testing  133
testing  71
testing  40
testing  55
testing  62
testing  66
testing  64
testing  65
66