# FactorInteger

gives a list of the prime factors of the integer n, together with their exponents.

FactorInteger[n,k]

does partial factorization, pulling out at most k distinct factors.

# Details and Options • FactorInteger is also known as prime factorization.
• For a positive number n=p1k1 pmkm with pi primes, gives a list {{p1,k1},,{pm,km}}.
• For negative numbers, the unit {-1,1} is included in the list of factors.
• FactorInteger also works on rational numbers. The prime factors of the denominator are given with negative exponents.
• factors over Gaussian integers.
• FactorInteger[m+I n] automatically works over Gaussian integers.
• When necessary, a unit of the form {-1,1}, {I,1} or {-I,1} is included in the list of factors.
• The last element in the list FactorInteger[n,k] gives what is left after the partial factorization.
• pulls out only factors that are easy to find.
• FactorInteger uses PrimeQ to determine whether factors are prime.

# Examples

open allclose all

## Basic Examples(2)

Find prime factors of and their exponents:

Plot the number of distinct prime factors of the first 100 numbers:

## Scope(6)

FactorInteger works over integers:

Rational numbers:

Gaussian integers:

Find a partial factorization:

Compute for large integers:

## Options(1)

### GaussianIntegers(1)

Factor a number over integers:

Gaussian integers:

## Applications(12)

### Basic Applications(5)

Every positive integer can be represented as a product of prime factors:

A unit factor:

Plot the number of distinct prime factors of numbers up to :

Compare with the number of distinct prime factors over the Gaussian integers:

Display as an explicit product of factors:

Use FactorInteger to test for prime powers:

Use FactorInteger to find all prime divisors of a number:

### Number Theory(7)

Use FactorInteger to compute the number of divisors of the number:

Use FactorInteger to recognize powerful numbers, numbers whose prime factors are all repeated:

Find factorizations of numbers of the form :

Find all natural numbers up to 100 that are primes or prime powers:

The highest power of a prime in numbers up to 100:

Find primes that appear in prime factorization of only to the first power:

Use FactorInteger to compute the square-free part of a number:

Visualize the distribution:

## Properties & Relations(9)

The prime factorization of a prime number is itself:

Prime powers:

Composite numbers have at least two prime factors including multiplicities:

Compute the original number from a factorization:

Exponents in the prime factorization of a square-free number are all :

Divisors gives the list of divisors including prime divisors:

PrimeNu gives the number of distinct prime factors:

PrimeOmega gives the number of prime factors counting multiplicities:

Coprime numbers have no prime factors in common:

If the prime factorization of n is given by , then the number of divisors of n is :

## Possible Issues(2)

Timings can increase rapidly and unpredictably with the size of the input:

FactorInteger at zero: