One way to implement these would be
digitalSum[k_Integer] := Total@IntegerDigits[k]
digitalRoot[k_Integer] := FixedPoint[digitalSum, k]
FixedPoint
will repeatedly apply digitalSum
until the result does not change. A more explicit implementation could use NestWhile
, with a check on the number of digits. But this trick with FixedPoint
makes the code shorter.