Last active
December 17, 2015 01:18
-
-
Save charlesponti/5526882 to your computer and use it in GitHub Desktop.
Project Euler: Problem 6
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
def sum_sq_diff(max) | |
sum_sqs = 0 | |
sq_sums = 0 | |
1.upto(max) { |i| sum_sqs += i**2 } | |
1.upto(max) { |i| sq_sums += i } | |
p sq_sums**2 - sum_sqs | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment