number-partitioner
Version:
Gernerates partitions for positive interger (https://en.wikipedia.org/wiki/Partition_(number_theory))
33 lines (30 loc) • 823 B
Markdown
See [Wikipedia](https://en.wikipedia.org/wiki/Partition_(number_theory)) for more info.
e.g. partitions of 8 are:
```
[
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
]
```
Currently able to generate partions for 1..65 (after that it usually fails with out of memory exception).Number of partitions grows exponentially, it takes a lot of memory. Uses caching and can be optimized further to reduce memory footprint by several times.