JuliaMath / JuliaMath/Combinatorics.jl
length(partitions(n)) and BigInt
- Dominant language
- Julia
- Stars
- 230
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
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 represented by `Int64` is for `n=405`. If we have two routines and
test whether `n>405`, and use either a big int or machine int Dict, then the results are faster for `n<405`, but not type stable. If we just always use a big int dict, then the function is typestable, but a bit slower for `n<405`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.