Factorization and Primality Testing