factors
Factorises an integer, preferably into prime factors.
Syntax

factors(n)

n
is an integer

Description

If
n
is a positive integer greater than or equal to2
,factors(n)
is the unique sorted list of prime numbers whose product isn
. The result is the same asPrimeFactors(n)
. 
If
n = 1
,factors(n) = '(1)
. (On the other hand,PrimeFactors(1) = '()
.) 
If
n = 0
,factors(n) = '(0)
. 
If
n
is a negative integer,factors(n)
is the same list asfactors(abs(n))
but with the first element with a minus sign.
Notes
Unlike PrimeFactors
, factors
is defined also for nonpositive integers. Moreover, while PrimeFactors(1)
is the empty list (the unique list of prime numbers whose product is 1
), factors(1)
is '(1)
. For positive integers greater than or equal to 2
, PrimeFactors
and factors
return the same list.
Unlike PrimeFactors
, the elements of factors(n)
might not be prime; indeed, 1
, 0
, and negative integers are not prime numbers.
Examples
factors(1)
1
factors(652358510)
2 5 17 3837403
factors(6454824420)
2 2 3 5 11 23 53 71 113
factors(4096)
2 2 2 2 2 2 2 2 2 2 2 2
factors(362014271)
362014271
factors(0)
0
factors(−652358510)
−2 5 17 3837403