solve it by half BF, consider b must be prime, good