JuliaMath / JuliaMath/Combinatorics.jl

Bug in integer_partitions(0)

Open
#143 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
230
Forks
62
PR merge metrics
No merged PRs in 30d

Description

`integer_partitions(0)` returns the empty list, while there is a partition of 0, namely `Int[]`.

The error is in src/partitions.c:459, which should return `Vector{Int}[[]]` or `[Int[]]`.

There is also a problem with `partitions(0)`:
```julia
julia> partitions(0)
Combinatorics.IntegerPartitions(0)

julia> collect(ans)
1-element Vector{Vector{Int64}}:
#undef

julia> integer_partitions(0)
Vector{Int64}[]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.