# Iterated product of digits

It is well-known that the interated sum-of-digits function equally distributes the numbers from $$1$$ to $$10^k-1$$ to the digits $$1,\ldots,9$$. And this holds true for any base $$b$$. For example, see the nearly decade-old MO question Sum of digits iterated. I want to ask a similar question for the product of digits.

Let $$\pi(n)$$ be the product-of-digits function, mapping $$n$$ to the product of the digits of $$n$$, and repeating until a single digit is reached. So $$\pi(13579) = 0$$ because $$13579 \rightarrow 1 \cdot 3 \cdot 5 \cdot 7 \cdot 9 = 945 \rightarrow 9 \cdot 4 \cdot 5 = 180 \rightarrow 0 \;.$$ If $$\pi( )$$ is applied to all the numbers from $$1$$ to $$m$$, the distribution naturally heavily favors $$0$$, but is otherwise (apparently) irregular:

$$\pi(n)$$ for $$n=1,\ldots,10^5-1=99999$$, base $$10$$.
The distribution for base $$5$$ seems to have a more regular distribution, with the frequency of each non-zero digit monotonically increasing:

$$\pi_5(n)$$ for $$n=1,\ldots,5^8-1=44444444_5$$, base $$5$$.
The limit distribution for each base appears to be just the $$0$$-digit bin approaching 100%, although there are arbitrarily large numbers that avoid mapping to $$0$$, for example, $$\pi(111\ldots111d111\ldots111) = d$$. Many details remain unclear to me:

Q. What explains the differently shaped distributions for $$\pi_b(n)$$ in different bases $$b$$? Can anything general be said?

Is it the case that, in base $$10$$, the bins for digits $$3$$ and $$7$$ are equal, both $$15$$ in the example above? Why does $$5$$ occur more frequently than $$3$$ and $$7$$?

Why are the digit frequencies increasing with digit value in base $$5$$, but not, say, in base $$7$$?

It may be that these questions have been previously explored, in which case pointers would be welcomed.

• Persistence of a number. Start with R. Guy's UPINT. Gerhard "You Know What It Means" Paseman, 2019.12.17. Dec 17 '19 at 15:19
• Also 10 has "zero divisors", while five and other prime bases don't. So you "get more chances" at nonzero results with prime bases. I never read the paper on persistence, but the dynamic (digit multiplication) collapses when enough zero divisors are encountered, and a basic question is how long can one iterate such a dynamic before collapse (or a fixed point is reached). For base 10, it is believed there is a finite upper bound, whereas for prime bases there is more of a question. Gerhard "Zero Is A Major Sink" Paseman, 2019.12.17. Dec 17 '19 at 15:58
• Modulo a prime, the numbers $\{0,1,\dots,p-1\}$ can be re-written as $\{0,1,g,g^2,g^3,\dots,g^{p-2}\}$ for a suitable $g$. Now, if $0$ does not occur, then the product of "digits" can be calculated in terms of the sum modulo $p-1$. Dec 17 '19 at 15:59
• has the sum-of-digits and product-of-digits behavior already been checked in the factorial number system; any surprises to be expected there? Dec 17 '19 at 16:20
• Clearly, 5 occurs more frequently that 3 or 7 because it is not coprime with 10: once any digit anywhere in the whole process becomes 5, the subsequent results will remain divisible by 5. Even digits occur more frequently than odd digits for the same reason. Dec 17 '19 at 16:47