Combinatorics.jl icon indicating copy to clipboard operation
Combinatorics.jl copied to clipboard

A combinatorics library for Julia

Results 72 Combinatorics.jl issues
Sort by recently updated
recently updated
newest added

The following error may be averted, or such functionality made possible with an additional method: https://github.com/JuliaMath/Combinatorics.jl/blob/c2114a71ccfc93052efb9a9379e62b81b9388ef8/src/factorials.jl#L47-L54 An example of how `‼︎` can be extended to the signed integers is found...

We are missing https://en.wikipedia.org/wiki/Composition_(combinatorics) I think equivalent to `unique(permutations(partitions(n))` For the compositions with bounded terms the total number is given by Fibonacci sequences: https://math.stackexchange.com/questions/3055314/number-of-compositions-of-n-such-that-each-term-is-less-than-equal-to-k

If you change the type of the dict to `Dict{BigInt,BigInt}` in this line https://github.com/JuliaMath/Combinatorics.jl/blob/master/src/partitions.jl#L58 then `length(partitions(n))` returns correct results for larger values of `n`. The largest result that can be...

`multinomial` internally uses `binomial`. While the latter check for overflow, the whole computation of `multinomial` is not checked for overflow, leading to : `multinomial(150, 150, 150, 150)` --> error overflow...

powerset(::Set) works, but returns Iterator. ```julia julia> s Set{Char} with 3 elements: 'a' 'c' 'b' julia> collect(powerset(s)) ERROR: MethodError: no method matching getindex(::Set{Char}, ::Int64) ``` `collect(powerset(collect(s)))` works as expected though....

It might be worthwhile to combine the `combinations` and `with_replacement_combinations` functions. I could see a potential API as ```julia combinations(x, n) # No replacement combinations(x, n, replace=true) # With replacement...

`permutations()` seems slower than it should be. Below is the example I discovered this with. I have an array of strings, of length ~2,000. I would like to produce all...

`stirlings2` is implemented twice in this package. - [`stirlings2`](https://github.com/JuliaMath/Combinatorics.jl/blob/v1.0.0/src/numbers.jl#L154) is correct but recursive and slow. - [`nfixedsetpartitions`](https://github.com/JuliaMath/Combinatorics.jl/blob/v1.0.0/src/partitions.jl#L338) is bugged eg. it silently overflows. `stirlings2` is slow : ``` julia> @btime...

Delannoy is one of the most common function used in Competitive Programming, therefore typed a dynamically programmed function for the same.

This would close #79 #80 and #81. Solution is due to @simonschoelly. Note that `integer_partitions` is still implemented, but now just `collect`s `partitions(n::Int)`. However, this implementation now returns the partitions...