Skip to content

Instantly share code, notes, and snippets.

@ccw
Created March 26, 2012 04:32
Show Gist options
  • Save ccw/2202944 to your computer and use it in GitHub Desktop.
Save ccw/2202944 to your computer and use it in GitHub Desktop.
[Project Euler in Groovy] - P6
def s1 = 0l, s2 = 0l
for (int i = 1; i <= 100; i++) {
s1 += (long)Math.pow(i, 2)
s2 += i
}
def x = (long)(Math.pow(s2, 2) - s1)
println x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment