View Source Multitool.Numbers.Factors (multitool v0.1.0)

Provides operations for working with the factors of numbers

A factor of a number x is any number which divides x without a remainder.

If x was 10, the factors of x would be [1, 2, 5, 10]

Link to this section Summary

Functions

Given a number n, retrieve a list of all factors for that number

Link to this section Functions

Given a number n, retrieve a list of all factors for that number

If n is less than one, return an empty list. The resulting list is not sorted.

parameters

Parameters

n: The number to retrieve factors of 

examples

Examples

iex> factors_of(3)
[1, 3]
iex> factors_of(0)
[]
iex> factors_of(100)
[1, 100, 2, 50, 4, 25, 5, 20, 10]