Home Online Manual
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.116 primefactors

Syntax:
primefactors ( int/bigint/number_expression )
primefactors ( int/bigint/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 int(s)/bigint(s), no ring needs to be active.
When called with numbers these are assumed to be integers in a polynomial ring over Q.
The method finds all prime factors of an integer n. n' will contain the sign, be zero, or the rest (when a bound is given) respectively. The returned list contains the following information: The returned list contains the following information:
L[1][i] = i-th prime factor (in ascending order),
L[2][i] = multiplicity of L[1][i],
L[3] = n'
Example:
 
  bigint n = bigint(7)^12 * bigint(37)^6 * 121;
  primefactors(n);
==> [1]:
==>    [1]:
==>       7
==>    [2]:
==>       11
==>    [3]:
==>       37
==> [2]:
==>    [1]:
==>       12
==>    [2]:
==>       2
==>    [3]:
==>       6
==> [3]:
==>    1
  primefactors(n,25);
==> [1]:
==>    [1]:
==>       7
==>    [2]:
==>       11
==> [2]:
==>    [1]:
==>       12
==>    [2]:
==>       2
==> [3]:
==>    2565726409
See prime.