euler/ruby/euler048.rb

4 lines
57 B
Ruby

def series(n)
(1..n).map { |x| x ** x }.inject(:+)
end