RosettaCodeData/Task/Digital-root-Multiplicative.../00DESCRIPTION

34 lines
1.4 KiB
Plaintext

The [[wp:Multiplicative digital root|multiplicative digital root]] (MDR) and multiplicative persistence (MP) of a number, <math>n</math>, is calculated rather like the [[Digital root]] except digits are multiplied instead of being added:
# Set <math>m</math> to <math>n</math> and <math>i</math> to <math>0</math>.
# While <math>m</math> has more than one digit:
#* Find a replacement <math>m</math> as the multiplication of the digits of the current value of <math>m</math>.
#* Increment <math>i</math>.
# Return <math>i</math> (= MP) and <math>m</math> (= MDR)
;Task:
* Tabulate the MP and MDR of the numbers 123321, 7739, 893, 899998
* Tabulate MDR versus the first five numbers having that MDR, something like:
<pre>
MDR: [n0..n4]
=== ========
0: [0, 10, 20, 25, 30]
1: [1, 11, 111, 1111, 11111]
2: [2, 12, 21, 26, 34]
3: [3, 13, 31, 113, 131]
4: [4, 14, 22, 27, 39]
5: [5, 15, 35, 51, 53]
6: [6, 16, 23, 28, 32]
7: [7, 17, 71, 117, 171]
8: [8, 18, 24, 29, 36]
9: [9, 19, 33, 91, 119]
</pre>
Show all output on this page.
;References:
* [http://mathworld.wolfram.com/MultiplicativeDigitalRoot.html Multiplicative Digital Root] on Wolfram Mathworld.
* [http://oeis.org/A031347 Multiplicative digital root] on The On-Line Encyclopedia of Integer Sequences.
* [https://www.youtube.com/watch?v=Wim9WJeDTHQ What's special about 277777788888899?] - Numberphile video
<br><br>