Sum of a series

say sum(1..1000, {|n| 1 / n**2 })

Alternatively, using the reduce{} method:

say (1..1000 -> reduce { |a,b| a + (1 / b**2) })

Output:

1.643934566681559803139058023822215589652103446494