On 15 June 2010 21:49, superpollo <span dir="ltr"><<a href="mailto:utente@esempio.net">utente@esempio.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

goal (from e.c.m.): evaluate 1^2+2^2+3^2-4^2-5^2+6^2+7^2+8^2-9^2-10^2+...-2010^2, where each three consecutive + must be followed by two - (^ meaning ** in this context)<br></blockquote><div><br>Obligatory one-liner:<br>
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">>>> sum((1, 1, 1, -1, -1)[(x-1) % 5] * x**2 for x in xrange(1, 2011))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">536926141</span><br>

<br>Cheers,<br>Xav <br></div></div>