Take any number $$n \in \mathbb{N}$$. Multiply all its digits together. Keep repeating this procedure with the obtained product, until it reaches a single digit. The number of steps required to do this is called the persistence of the number $$n$$ and the final digit obtained is called the digital root of $$n$$.

For instance, starting from 327, the product of the digits is $$3 \times 2 \times 7 = 42$$. Then recurring with 42 the product of the digits is $$4 \times 2 = 8$$, which stops the procedure. The sequence $$327 \longrightarrow 42 \longrightarrow 8$$ finished in two steps, so the number 327 has persistence 2 and digital root 8.

277777788888899
The number 277777788888899 has persistence 11.

The current record holder is 277777788888899 with a persistence of 11. It is conjectured that there is no number with persistence greater than 11. Supercomputer power has been used to check that this is the case for all numbers up to $$10^{400}$$.

Assignment

Example

>>> multiplication(327)
42
>>> multiplication(42)
8
>>> multiplication(277777788888899)
4996238671872

>>> digital_root(327)
8
>>> digital_root(68889)
0
>>> digital_root(277777788888899)
0

>>> persistence(327)
2
>>> persistence(8)
0
>>> persistence(277777788888899)
11

>>> most_persistent(1, 100)
77
>>> most_persistent(100, 1000)
679
>>> most_persistent(1000, 10000)
6788
>>> most_persistent(277777788888000, 277777788889000)
277777788888899