Every partition of an integer
Usage
morie_partitions_of(n, max_part = NULL)
Arguments
- n
Non-negative integer.
- max_part
Largest part allowed; defaults to n.
Value
A list of integer vectors, each weakly decreasing.
Examples
morie_partitions_of(n = 5L)
#> [[1]]
#> [1] 5
#>
#> [[2]]
#> [1] 4 1
#>
#> [[3]]
#> [1] 3 2
#>
#> [[4]]
#> [1] 3 1 1
#>
#> [[5]]
#> [1] 2 2 1
#>
#> [[6]]
#> [1] 2 1 1 1
#>
#> [[7]]
#> [1] 1 1 1 1 1
#>