Improve performaces by testing until half of number