<div dir="ltr"><br><br>On Wednesday, November 18, 2015 at 3:25:12 AM UTC-6, Kees Bleijenberg wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div lang="NL" link="blue" vlink="purple"><div><p class="MsoNormal">I want to partition the integer n=180 with terms >=5</p><p class="MsoNormal">I.e.  n=15 => [[5,5,5],[8,7],[9,6],[10,5],[<wbr>15]]</p></div></div></blockquote><div><br></div><div>For an alternate way to produce partitions, have a look at how the combinat package does it:</div><div><br></div><div>https://hackage.haskell.org/package/combinat-0.2.8.1/docs/src/Math-Combinat-Partitions-Integer.html#line-308</div><div><br></div><div>In particular, in this part:</div><div><br></div><pre style="color: rgb(0, 0, 0);"><font face="courier new, monospace"><span class="hs-sel">    _partitions'</span> <span class="hs-layout" style="color: red;">(</span><span class="hs-varop">!</span><span class="hs-varid">h</span> <span class="hs-layout" style="color: red;">,</span><span class="hs-varop">!</span><span class="hs-varid">w</span><span class="hs-layout" style="color: red;">)</span> <span class="hs-varid">d</span> <span class="hs-keyglyph" style="color: red;">=</span>  <span class="hs-keyglyph" style="color: red;">[</span> <span class="hs-varid">i</span><span class="hs-conop">:</span><span class="hs-varid">xs</span> <span class="hs-keyglyph" style="color: red;">|</span> <span class="hs-varid">i</span> <span class="hs-keyglyph" style="color: red;"><-</span> <span class="hs-keyglyph" style="color: red;">[</span><span class="hs-num">1</span><span class="hs-keyglyph" style="color: red;">..</span><span class="hs-varid">min</span> <span class="hs-varid">d</span> <span class="hs-varid">h</span><span class="hs-keyglyph" style="color: red;">]</span> <span class="hs-layout" style="color: red;">,</span> <span class="hs-varid">xs</span> <span class="hs-keyglyph" style="color: red;"><-</span> <span class="hs-sel">_partitions'</span> <span class="hs-layout" style="color: red;">(</span><span class="hs-varid">i</span><span class="hs-layout" style="color: red;">,</span><span class="hs-varid">w</span><span class="hs-comment" style="color: green;">-</span><span class="hs-num">1</span><span class="hs-layout" style="color: red;">)</span> <span class="hs-layout" style="color: red;">(</span><span class="hs-varid">d</span><span class="hs-comment" style="color: green;">-</span><span class="hs-varid">i</span><span class="hs-layout" style="color: red;">)</span> <span class="hs-keyglyph" style="color: red;">]</span></font></pre><div><br></div><div>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.</div><div><br></div><div>After you make the change, call the function like this: _partitions' (180,180) 180</div><div><br></div></div>