From: Max Williams Date: 2008-07-01T02:58:51+09:00 Subject: how to - quickly make permutations? can anyone provide an elegant implementation for this method? #gives all distinct combinations of numbers up to n, with maximum size max_size def permutations(n,max_size) so, eg, permutations(4,2) => [[1],[2],[3],[4],[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]] permutations(4,3) => above + [[1,2,3],[1,2,4],[2,3,4]] i'm guessing something recursive is the key but i can't quite work out the best way. thanks max -- Posted via http://www.ruby-forum.com/.