There's a mathematical property called the digital root. For any number , the digital root equals .
Why does this work? A number and the sum of its digits have the same remainder when divided by . Repeatedly summing digits preserves this remainder until you get a single digit.
Special case: if , the answer is . Otherwise, use the formula. This gives you time instead of .