15 May 2008

Kick it, Euler:

The sum of the squares of the first ten natural numbers is,

1

^{2}+ 2^{2}+ … + 10^{2}= 385The square of the sum of the first ten natural numbers is,

(1 + 2 + … + 10)

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

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

Not much to this one. I learned about the exponentiation operator which seems to be a rewrite to calling a Pow method (it doesn’t seem to work on int). Here’s a “my brain is currently warped into thinking about everything as a sequence and operations on sequences”-solution:

```
([1.0..100.0] |> Seq.fold (+) 0.0) ** 2.0
- ([1.0..100.0] |> Seq.map(fun x -> x*x) |> Seq.fold(+) 0.0)
```

See y’all next time.