Efficiently calculate the value of an arithmetic sequence
Seems trivial. Pair them, each pair is worth -1.
f(1000) =  1 - 2  +  3 - 4  + ... +  999 - 1000
        = (1 - 2) + (3 - 4) + ... + (999 - 1000)
        =   -1        -1    + ... +     -1
        = -500

Odd n left as exercise for the reader.
(I wrote this when the question title still said &quot;1 − 2 + 3 − 4 + · · ·&quot;, can't be bothered to switch all signs now.)