In formal writing, if you can write out the number in one or two words, you should generally do so, and use figures for longer numbers.
If one of several numbers of the same kind in the same sentence requires a figure, use figures for all the numbers in that sentence.