Learn R Programming

stat.extend (version 0.2.1)

lsubfactorial: Logarithm of the subfactorial numbers

Description

lsubfactorial returns the logarithms of the subfactorial numbers.

Usage

lsubfactorial(x)

Arguments

x

A vector of non-negative integers

Value

If the input is a vector of non-negative integers, the output will be a vector of the logarithms of the corresponding subfactorial numbers.

Details

The subfactorial numbers count the number of derangements of a set of objects (permutations in which no element appears in its original position). This function computes the logarithms of the subfactorial numbers for a given input vector specifying the numbers of interest.

Examples

Run this code
# NOT RUN {
# In the limit n! / !n goes to e
# so limit of differences of logs is 1
lfactorial(1000) - lsubfactorial(1000)


# }

Run the code above in your browser using DataLab