Added Lehmer's algorithm for Case #4