binary search buffered prime implemented