Digital root/Multiplicative digital root: Difference between revisions
Content added Content deleted
m (→{{header|Tcl}}: more informative variable names) |
(Convert to task, tidy up presentation of task description) |
||
Line 1: | Line 1: | ||
{{ |
{{task|Mathematics}} |
||
The [[wp:Multiplicative digital root|multiplicative digital root]] (MDR) and multiplicative persistence (MP) of a number |
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: |
;Task: |