arr = [1,1,1,3,3,3,5,5,5,7,7,7,9,9,9,11,11,11,13,13,13,15,15,15]p arr.combination(3).select{|c| c.reduce(:+) == 30}
Standard input is empty
[]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!