Top
Back: prime
Forward: print
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.106 primefactors

Syntax:
primefactors ( bigint_expression , [ int_expression ] )
Syntax:
primefactors ( number_expression , [ int_expression ] )
Type:
list
Purpose:
returns the prime factorisation up to an optionally given bound, b, on the prime factors
When called with a bigint, no ring needs to be active.
The method is capable of finding all prime factors <= 2^31 - 1, i.e., it finds all prime factors <= min(2^31-1, b). The quotient, q, arising by dividing out all found prime factors will also be returned. More concretely, a list L with three entries is returned:
L[1] = q,
L[2][i] = i-th prime factor (in ascending order),
L[3][i] = multiplicity of L[2][i].
Example:
 
  bigint n = bigint(7)^12 * bigint(37)^6 * 121;
  primefactors(n);
==> [1]:
==>    1
==> [2]:
==>    [1]:
==>       7
==>    [2]:
==>       11
==>    [3]:
==>       37
==> [3]:
==>    [1]:
==>       12
==>    [2]:
==>       2
==>    [3]:
==>       6
  primefactors(n, 15); /* only prime factors <= 15 */
==> [1]:
==>    1
==> [2]:
==>    [1]:
==>       7
==>    [2]:
==>       11
==>    [3]:
==>       37
==> [3]:
==>    [1]:
==>       12
==>    [2]:
==>       2
==>    [3]:
==>       6
See prime.

Top Back: prime Forward: print FastBack: Functions and system variables FastForward: Control structures Up: Functions Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 3-1-1, Feb 2010, generated by texi2html.