isPrime was returning wrong result for values < 6