Properly detect non-prime numbers