Maxima Function
divisors (n)
Represents the set of divisors of n.
divisors(n)
simplifies to a set of integers
when n is a nonzero integer.
The set of divisors includes the members 1 and n.
The divisors of a negative integer are the divisors of its absolute value.
divisors
distributes over equations, lists, matrices, and sets.
Examples:
We can verify that 28 is a perfect number: the sum of its divisors (except for itself) is 28.
(%i1) s: divisors(28); (%o1) {1, 2, 4, 7, 14, 28} (%i2) lreduce ("+", args(s)) - 28; (%o2) 28
divisors
is a simplifying function.
Substituting 8 for a
in divisors(a)
yields the divisors without reevaluating divisors(8)
.
(%i1) divisors (a); (%o1) divisors(a) (%i2) subst (8, a, %); (%o2) {1, 2, 4, 8}
divisors
distributes over equations, lists, matrices, and sets.
(%i1) divisors (a = b); (%o1) divisors(a) = divisors(b) (%i2) divisors ([a, b, c]); (%o2) [divisors(a), divisors(b), divisors(c)] (%i3) divisors (matrix ([a, b], [c, d])); [ divisors(a) divisors(b) ] (%o3) [ ] [ divisors(c) divisors(d) ] (%i4) divisors ({a, b, c}); (%o4) {divisors(a), divisors(b), divisors(c)}