factorize function

Prime Factorization of Integers

Prime Factorization of Integers

Compute the prime factorization(s) of integer(s) n.

factorize(n, verbose = FALSE)

Arguments

  • n: vector of integers to factorize.
  • verbose: logical indicating if some progress information should be printed.

Details

works via primes, currently in a cheap way, sub-optimal for large composite nn.

Returns

A named list of the same length as n, each element a 2-column matrix with column "p" the prime factors and column~"m" their respective exponents (or multiplities), i.e., for a prime number n, the resulting matrix is cbind(p = n, m = 1).

Author(s)

Martin Maechler, Jan. 1996.

See Also

primes.

For factorization of moderately or really large numbers, see the list("gmp")

package, and its factorize().

Examples

factorize(47) factorize(seq(101, 120, by=2))
  • Maintainer: Martin Maechler
  • License: GPL (>= 2)
  • Last published: 2024-11-05