
18 Nov
2015
18 Nov
'15
3:49 p.m.
On Wednesday, November 18, 2015 at 3:25:12 AM UTC-6, Kees Bleijenberg wrote:
I want to partition the integer n=180 with terms >=5
I.e. n=15 => [[5,5,5],[8,7],[9,6],[10,5],[15]]
For an alternate way to produce partitions, have a look at how the combinat package does it: https://hackage.haskell.org/package/combinat-0.2.8.1/docs/src/Math-Combinat-... In particular, in this part: _partitions' (!h ,!w) d = [ i:xs | i <- [1..min d h] , xs <- _partitions' (i,w-1) (d-i) ] if you change `i <- [1..min d h]` to ` i <- [5..min d h]` it appears you will get the partitions which have size at least 5. After you make the change, call the function like this: _partitions' (180,180) 180