A common technique in parallelization is to fuse nested for loops like this
for(int i=0; i
to
The most sane form is of course the first form.
That said, the fused form is better done with conditionals:
int i = 0; int j = 0; for(int x=0; x<(n*(n+1)/2); x++) { // ... ++j; if (j>i) { j = 0; ++i; } }