Learn R Programming

numbers (version 0.3-1)

factorize: Prime Factors

Description

Returns a vector containing the prime factors of n.

Usage

factorize(n)

Arguments

n
nonnegative integer

Value

  • Vector containing the prime factors of n.

Details

Computes the prime factors of n in ascending order, each one as often as its multiplicity requires, such that n == prod(factorize(n)).

See Also

isPrime, Primes

Examples

Run this code
factorize(1002001)       # 7  7  11  11  13  13
  factorize(65537)         # is prime
  # Euler's calculation
  factorize(2^32 + 1)      # 641  6700417

Run the code above in your browser using DataLab