fork download
  1. n = [0, 3, 5, 6]
  2. a = n + n.reverse.map {|x| 15 - x}
  3. b = (0..15).to_a - a
  4. [a, ' ', b].each{|x| print x}
  5. print "\n"
  6. (0..3).each do |p|
  7. ai = a.map{|x| x ** p}.inject(:+)
  8. bi = b.map{|x| x ** p}.inject(:+)
  9. [ai,bi].each{|x| printf "%5d", x}
  10. print "\n"
  11. end
Success #stdin #stdout 0.01s 7460KB
stdin
Standard input is empty
stdout
[0, 3, 5, 6, 9, 10, 12, 15] [1, 2, 4, 7, 8, 11, 13, 14]
    8    8
   60   60
  620  620
 7200 7200