1 | initial version |
This is the fastest way to solve your mystery:
int n = 9000;
int a = n*(n-1)/2;
By the way, while this is not what you are looking for, it proves a point: the best optimizations are algorithm simplifications, not brute-force calculations.
And if you want an example code for OpenMP or TBB, please have a look in their documentation.