test(i,r):
lo = 1; hi = i
while lo < hi:
mid = lo + (hi-lo)//2
if r*mid*mid < i*i:
lo = mid+1
else:
hi = mid
return r*lo*lo < (i+1)*(i+1)The search interval is valid because . Once the least witness is located, the final strict upper test decides membership, by part (a). No recursion or approximate square root is used.
Articles by others on the same topic
There are currently no matching articles.