Primality and factorization