Improvement: loop used to move to square number before target when target >= 16