Top
Back: D.2.2.18 primecoeffs
Forward: D.2.2.20 timeStd
FastBack: D. SINGULAR libraries
FastForward: E. Release Notes
Up: D.2.2 general_lib
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

D.2.2.19 primefactors

Procedure from library general.lib (see general_lib).

Usage:

primefactors(n [,p]); n = int or number, p = integer

Compute:

primefactors <= min(p,32003) of n (default p = 32003)

Return:

a list, say l,
l[1] : primefactors <= min(p,32003) of n
l[2] : l[2][i] = multiplicity of l[1][i]
l[3] : remaining factor ( n=product{ (l[1][i]^l[2][i])*l[3]} ) type(l[3])=typeof(n)

Note:

If n is a long integer (of type number) then the procedure finds primefactors <= min(p,32003) but n may be larger as 2147483647 (max. integer representation)

Warning:

the procedure works for small integers only, just by testing all primes (not to be considerd as serious prime factorization!)

Example:

 
LIB "general.lib";
primefactors(7*8*121);
→ [1]:
→    2,7,11
→ [2]:
→    3,1,2
→ [3]:
→    1
ring r = 0,x,dp;
primefactors(123456789100);
→ [1]:
→    2,5
→ [2]:
→    2,2
→ [3]:
→    1234567891

Top Back: D.2.2.18 primecoeffs Forward: D.2.2.20 timeStd FastBack: D. SINGULAR libraries FastForward: E. Release Notes Up: D.2.2 general_lib Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.