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.108 primefactors

Syntax:
primefactors ( int/bigint/number_expression , [ int/bigint/number_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. When some positive bound b is given then it is expected to be at least 2. In this case, the implementation finds only all prime factors <= b. Then, there may remain a non-factored portion n' of n arising by dividing out all found prime factors. Moreover, in case n is negative or zero, n' will contain the sign or be zero, respectively. 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',
L[4] = 1 if probabilistic test says that |n'| is a prime, 0 otherwise.
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
==> [4]:
==>    0
  primefactors(n, 15); /* only prime factors <= 15 */
==> [1]:
==>    [1]:
==>       7
==>    [2]:
==>       11
==> [2]:
==>    [1]:
==>       12
==>    [2]:
==>       2
==> [3]:
==>    2565726409
==> [4]:
==>    0
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-3, March 2011, generated by texi2html.