Debian Codegraph @

man/factorize.Rd

raw
1 \name{factorize}
2 \alias{factorize}
3 \title{Prime Factorization of Integers}
4 \description{
5 Compute the prime factorization(s) of integer(s) \code{n}.
6
7 % ## Purpose: Prime factorization of integer(s) 'n'
8 % ## -------------------------------------------------------------------------
9 % ## Arguments: n vector of integers to factorize (into prime numbers)
10 % ## --> needs 'prime.sieve'
11 % ## >> Better would be: Define class 'primefactors' and "multiply" method
12 % ## then use this function recursively only "small" factors
13 % ## -------------------------------------------------------------------------
14 }
15 \usage{
16 factorize(n, verbose = FALSE)
17 }
18 \arguments{
19 \item{n}{vector of integers to factorize.}
20 \item{verbose}{logical indicating if some progress information should
21 be printed.}
22 }
23 \details{
24 works via \code{\link{primes}}, currently in a cheap way, sub-optimal
25 for large composite \eqn{n}.
26 %% FIXME: ALSO,
27 %% % ## >> Better would be: Define class 'primefactors' and "multiply" method
28 }
29 \value{
30 A named \code{\link{list}} of the same length as \code{n},
31 each element a 2-column matrix with column \code{"p"} the prime
32 factors and column~\code{"m"} their respective exponents (or
33 multiplities), i.e., for a prime number \code{n}, the resulting matrix
34 is \code{cbind(p = n, m = 1)}.
35 }
36 \author{Martin Maechler, Jan. 1996.}
37 \seealso{
38 \code{\link{primes}}.
39
40 For factorization of moderately or really large numbers, see the \CRANpkg{gmp}
41 package, and its \code{\link[gmp]{factorize}()}.
42 }
43 \examples{
44 factorize(47)
45 factorize(seq(101, 120, by=2))
46 }
47 \keyword{math}
48