Digital root/Multiplicative digital root: Difference between revisions

m
added whitespace before the TOC (table of contents), added other whitespace to the task's preamble.
m (→‎{{header|Sidef}}: minor code fix for Sidef 2.30)
m (added whitespace before the TOC (table of contents), added other whitespace to the task's preamble.)
Line 1:
{{task|Mathematics}}
 
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>.
Line 6 ⟶ 7:
#* 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]
MDR: [n0..n4]
=== ========
0: [0, 10, 20, 25, 30]
Line 21 ⟶ 24:
7: [7, 17, 71, 117, 171]
8: [8, 18, 24, 29, 36]
9: [9, 19, 33, 91, 119]</pre>
</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.
<br><br>
 
=={{header|Ada}}==