Algosim documentation: factors

factors

Factorises an integer, preferably into prime factors.

Syntax

Description

Notes

Unlike PrimeFactors, factors is defined also for non-positive 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

See also