In an earlier paper by one of us (Behrend), Donaldson-Thomas type invariants were expressed as certain weighted Euler characteristics of the moduli space. The Euler characteristic is weighted by a certain canonical
Z-valued constructible function on the moduli space. This constructible function associates to
any point of the moduli space a certain invariant of the singularity of the space at the point. Here we evaluate this invariant for the case of a singularity that is an isolated point of a C∗-action and that admits a symmetric obstruction theory compatible with the C∗-action. The answer is (-1)d, where d
is the dimension of the Zariski tangent space. We use this result to prove that for any threefold, proper or not, the weighted Euler characteristic of the Hilbert scheme of n points on the threefold is, up to sign, equal to the usual Euler characteristic. For the case of a projective Calabi-Yau threefold, we deduce that the Donaldson-Thomas invariant of the Hilbert scheme of n points is, up to sign, equal to the Euler characteristic. This proves a conjecture of Maulik, Nekrasov, Okounkov and Pandharipande.