From: Regis d'Aubarede Date: 2013-04-15T07:24:19+09:00 Subject: Re: Looking for more elegant solutions. def mails( n, times ,already=[], accu=[]) return accu << already if n > times nexts=(1..times).to_a - already-[n] nexts.each { |i| mails( n+1, times, already+[i], accu ) } accu end p mails(1,4) -- Posted via http://www.ruby-forum.com/.