Sha256: d2edea6fe196a0f053ecb0293d939ca20a50f08075821f11d27715c94b470a60

Contents?: true

Size: 1.08 KB

Versions: 167

Compression:

Stored size: 1.08 KB

Contents

# Difference Of Squares

Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.

The square of the sum of the first ten natural numbers is
(1 + 2 + ... + 10)² = 55² = 3025.

The sum of the squares of the first ten natural numbers is
1² + 2² + ... + 10² = 385.

Hence the difference between the square of the sum of the first
ten natural numbers and the sum of the squares of the first ten
natural numbers is 3025 - 385 = 2640.

For installation and learning resources, refer to the
[exercism help page](http://exercism.io/languages/groovy).

Run the tests by executing the test script.

```
$ groovy ./DifferenceOfSquaresSpec.groovy
```

After the first test(s) pass, continue by commenting out or removing the `@Ignore` annotations prepending other tests.

When all tests pass, congratulations!

## Source

Problem 6 at Project Euler [http://projecteuler.net/problem=6](http://projecteuler.net/problem=6)

## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

Version data entries

167 entries across 167 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.179 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.178 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.177 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.176 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.175 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.174 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.173 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.172 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.171 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.170 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.169 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.167 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.166 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.165 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.164 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.163 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.162 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.161 tracks/groovy/exercises/difference-of-squares/README.md
trackler-2.2.1.160 tracks/groovy/exercises/difference-of-squares/README.md