Derive a formula for evaluating the following expression in terms of n, given that n is a positive integer.

**Σ**_{i = 1 to n2} ([√ i] + <√ i>)

__Note__: [x] is the greatest integer ≤ x, and <x> is the least integer ≥x.

Hmm. Wonder why nobody has tackled this yet? Must be Christmas break. Well, here's a start:

[√ i] = n if i = n*n, or n-1 if (n-1)(n-1) < i < n*n

<√ i> = n if (n-1)(n-1) < i <= n*n

so

[√ i] + <√ i> = 2n if i = n*n, or (2n-1) if (n-1)(n-1) < i < n*n

Going from (n-1)(n-1) to n*n involves adding

(n-1)(n-1) - n*n = 2n-1 terms,

1 whose value is 2n and (2n-2) whose value is (2n-1).

Simplifying, going from (n-1)(n-1) to n*n involves adding

2n + (2n-2)(2n-1) = 4n*n - 4n + 2

So, the sought after expression is the same as

**Σ**_{i = 1 to n} (4n*n - 4n + 2)

**I'll stop here. **These summations are fairly well known, but it's too much algebra for me right now (plus I am obviously not good at writing exponents on perplexus. The solution involves 4th powers, and I would embarrass myself writing n*n*n*n where I mean n to the 4th power).