factors takes a number and then returns all of its factors

factors(given)

Arguments

given

A integer.

Value

A vector of numbers.

Complexity

This function has the following complexity O($n^2$)

Examples

factors(1)
#> [1] 1
factors(123)
#> [1] 1 3 41 123
factors(456)
#> [1] 1 2 3 4 6 8 12 19 24 38 57 76 114 152 228 456