The common_factors function takes a set of numbers and identifies the common factors between them. It can also be used to identify the greatest common factor of a set of numbers.

common_factors(..., greatest = FALSE)

Arguments

...

The numbers that you want to get the common factors of.

greatest

Logical. Should the result be only the greatest common factor? Defaults to FALSE.

Value

A numeric vector.

Examples

common_factors(18, 48)
#> [1] 1 2 3 6
common_factors(25, 50, 100, greatest = TRUE)
#> [1] 25