x = 0; While[Length[Divisors[Sum[k, {k, 1, x}]]] < 501, x = x + 1]; Sum[k, {k, 1, x}]