divisors: List of Divisors

View source: R/divisors.R

divisorsR Documentation

List of Divisors

Description

Generates a list of divisors of an integer number.

Usage

divisors(n)

Arguments

n

integer whose divisors will be generated.

Details

The list of all divisors of an integer n will be calculated and returned in ascending order, including 1 and the number itself. For n>=1000 the list of prime factors of n will be used, for smaller n a total search is applied.

Value

Returns a vector integers.

See Also

primeFactors, Sigma, tau

Examples

divisors(1)          # 1
divisors(2)          # 1 2
divisors(2^5)        # 1  2  4  8 16 32
divisors(1000)       # 1  2  4  5  8 10 ... 100 125 200 250 500 1000
divisors(1001)       # 1  7 11 13 77 91 143 1001

numbers documentation built on Nov. 23, 2022, 9:06 a.m.