in reply to Re^3: How to restrict partitions
in thread How to restrict partitions

That works to give me the exact number of summands I'm looking for but it give me repeat summands. I get the idea behind the subroutine but I'm not sure how to change it so that it gives only partitions with distinct summands. I tried tinkering with the truth values & the != etc but it didn't seem to do the trick.

Replies are listed 'Best First'.
Re^5: How to restrict partitions
by choroba (Cardinal) on Jan 18, 2014 at 09:41 UTC
    In Perl, "distinct" means "hash":
    sub distinct { my %distinct; @distinct{@_} = (); return keys %distinct; }
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ