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:
{{draft task}}
{{task|Mathematics}}
The [[wp:Multiplicative digital root|multiplicative digital root]] (MDR) and multiplicative persistence (MP) of a number (N) is calculated rather like the [[Digital root]] except digits are multiplied:
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 MDR to N and MP to 0
# Set <math>m</math> to <math>n</math> and <math>i</math> to <math>0</math>.
:* While MDR has more than one digit:
# While <math>m</math> has more than one digit:
::* Find a replacement MDR as the multiplication of the digits of the current MDR
#* Find a replacement <math>m</math> as the multiplication of the digits of the current value of <math>m</math>.
::* Increment MP
#* Increment <math>i</math>.
:* Return MP and MDR
# Return <math>i</math> (= MP) and <math>m</math> (= MDR)


;Task:
;Task: