RobinHankin / partitions

R package for integer partitions
9 stars 5 forks source link

listParts with large sets #16

Closed pjbouchet closed 2 years ago

pjbouchet commented 3 years ago

I am getting the following error when running listParts using a large number for x, the size of the set to be partitioned.

partitions::listParts(x = 20)

Error in integer(sum(x) * num.of.parts) : vector size cannot be NA In addition: Warning message: In sum(x) * num.of.parts : NAs produced by integer overflow

Any idea how to solve this? I realise that there is a very large number of possible partitions, and wanted to check wether the package could handle such a request.

Many thanks!

sessionInfo(package = NULL) R version 4.0.5 (2021-03-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server x64 (build 14393)

RobinHankin commented 3 years ago

I get about 6e13 for the 20th Bell number, way too large to handle. It might be possible to write an equivalent of nextpart() but even if it took one millisecond per visit this still would take ~40000 years to complete.

pjbouchet commented 3 years ago

Many thanks for your response! Appreciate it.