Macaulay2 » Documentation
Packages » Macaulay2Doc :: factor(RingElement)
next | previous | forward | backward | up | index | toc

factor(RingElement) -- factor a ring element

Synopsis

Description

The result is a Product each of whose factors is a Power whose base is one of the factors found and whose exponent is an integer.

i1 : factor 124744878111332355674003415153753485211381849014286981744945

                7
o1 = 3*5*53*2819 10861*10212222054939737109085868749

o1 : Expression of class Product
i2 : y = (2^15-4)/(2^15-5)

     32764
o2 = -----
     32763

o2 : QQ
i3 : x = factor y

       2
      2 8191
o3 = --------
     3*67*163

o3 : Expression of class Divide
i4 : value x

     32764
o4 = -----
     32763

o4 : QQ

We may peek inside x to a high depth to see its true structure as Expression.

i5 : peek'(100,x)

o5 = Divide{Product{Power{2, 2}, Power{8191, 1}}, Product{Power{3, 1},
     ------------------------------------------------------------------------
     Power{67, 1}, Power{163, 1}}}

For integers, factorization is done by FLINT, and the factors $x$ are actually just probably prime, as described in the documentation of isPseudoprime.

For multivariate polynomials the factorization is done with code of Michael Messollen (see Singular-Factory). For univariate polynomials the factorization is in turn done with code of Gert-Martin Greuel and Ruediger Stobbe (see Singular-Factory).

i6 : R = ZZ/101[u]

o6 = R

o6 : PolynomialRing
i7 : factor (u^3-1)

              2
o7 = (u - 1)(u  + u + 1)

o7 : Expression of class Product
The constant term is provided as the last factor, if it's not equal to 1.
i8 : F = frac(ZZ/101[t])

o8 = F

o8 : FractionField
i9 : factor ((t^3-1)/(t^3+1))

              2
     (t - 1)(t  + t + 1)
o9 = -------------------
              2
     (t + 1)(t  - t + 1)

o9 : Expression of class Divide

Ways to use this method: