Last active
January 18, 2017 18:12
-
-
Save pawlos/1ee84e7f19aba42f8489a5b1970ef867 to your computer and use it in GitHub Desktop.
Calculate the sum of square numbers from 1 to 500
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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