# Summing Digits

Logic Level 4

It's common that, given a positive integer $$n$$, to find the sum of its digits. For example, 2016 has digit sum 9, and 9686 has digit sum 29. This process can be iterated until we get a digit sum that has only a single digit. For example, 2016 arrives to the single-digit 9 in a single step, but 9686 takes three steps, going to 29, 11, before arriving at 2.

Let $$Z(n)$$ be the number of digit-sum iterations needed from $$n$$ to arrive to a single-digit result. For example, $$Z(2016) = 1$$ and $$Z(9686) = 3$$.

Let $$X(z)$$ be the smallest positive integer $$n$$ such that $$Z(n) = z$$. For example, $$X(1) = 10$$ and $$X(2) = 19$$.

Find $$X(4562) \bmod 6$$.

×