Revert "re arranging the check for prime"

This reverts commit 91f05ed2d2b04e21678114c271fa3ced985d0d12.