From: Pablo Bianciotto Date: 2013-04-13T00:34:53+09:00 Subject: Re: Looking for more elegant solutions. Try the following: 1.upto(n).to_a.permutation(n).to_a.delete_if do |perm| perm.any? { |letter| letter == perm[letter -1] } end Bye -- Posted via http://www.ruby-forum.com/.