Some homeworks

The actual exam task was:
''''
Find the value of:
int k=0;
for (int i=0, i < 5; i++)
    for (int j=0; j < i; j++)
        k+=j;
''''
The result is 10, but actually I wanted some code that could do this stuff,
so here it is this useless code.

Some speed tests:
http://pastebin.com/Q9P6AJB5