Skip to content

Instantly share code, notes, and snippets.

@pawlos
Last active January 18, 2017 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawlos/1ee84e7f19aba42f8489a5b1970ef867 to your computer and use it in GitHub Desktop.
Save pawlos/1ee84e7f19aba42f8489a5b1970ef867 to your computer and use it in GitHub Desktop.
Calculate the sum of square numbers from 1 to 500
require "fun" ()
n = 500
print(reduce(operator.add, 0, map(function(x) return x^2 end, range(n))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment