Skip to content

Instantly share code, notes, and snippets.

@avescodes
Created March 7, 2010 01:48
Show Gist options
  • Save avescodes/324093 to your computer and use it in GitHub Desktop.
Save avescodes/324093 to your computer and use it in GitHub Desktop.
def three_amigos_please
0.upto(128) do |i|
0.upto(128) do |j|
0.upto(128) do |k|
if i != j and j != k and i != k
yield ("0"*128).split('').map {|n| [i,j,k].include?(n) ? "1" : "0" }.join('')
end
end
end
end
end
alias permutation three_amigos_please
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment