There are 40 ways to make sums of three distinct positive integers total 25. (1+2+22 is such a sum, but 1+12+12 and 1+2+3+19 are not.)

How many different ways can three distinct positive integers sum to 1000?

83834, produced in half a second by the following awk program:

BEGIN {

total = 0;

for (A=0; A<=1000; A++)

{ for (B=A; B<=1000; B++)

{

C = 1000-A-B;

if (C>=B) total++

}

}

print total

}