Function Repository Resource:

MultiplicativeDigitalRoot

Source Notebook

Compute the multiplicative digital root, in any base, of an integer

Contributed by: Christopher Stover

ResourceFunction["MultiplicativeDigitalRoot"][n,b]

gives the multiplicative digital root of the non-negative integer n when expressed in the base b.

ResourceFunction["MultiplicativeDigitalRoot"][n]

gives the base-10 muliplicative digital root of n.

Details

Starting with a non-negative integer n, multiply its base-b digits, then multiply the digits of the resulting number, etc., until the result has only one digit. The one-digit integer marking the stopping point of this process is called the multiplicative digital root of n.
As an example in base 10, consider n=14691:
Multiplying its digits yields 1×4×6×9×1=216.
Multiplying the digits of the result yields 2×1×6=12.
Multiplying the digits of the result yields 1×2=2. Because 2 is a single-digit number, the process stops.
Because the integer marking the termination of the process is 2, ResourceFunction["MultiplicativeDigitalRoot"][14691] returns 2.
ResourceFunction["MultiplicativeDigitalRoot"] threads elementwise over lists.

Examples

Basic Examples (2) 

Compute the multiplicative digital root of 1191:

In[1]:=
ResourceFunction["MultiplicativeDigitalRoot"][1191]
Out[1]=

Compute the additive digital root of 1191, base-14:

In[2]:=
ResourceFunction["MultiplicativeDigitalRoot"][1191, 14]
Out[2]=

Scope (2) 

MultiplicativeDigitalRoot threads elementwise over lists:

In[3]:=
listIn = {13, 248, 66677, 89};
ResourceFunction["MultiplicativeDigitalRoot"][listIn]
Out[4]=
In[5]:=
ResourceFunction["MultiplicativeDigitalRoot"][listIn, 7]
Out[5]=

Compute the multiplicative digital root of the first 100 integers (OEIS A031347):

In[6]:=
ResourceFunction["MultiplicativeDigitalRoot"] /@ Range[0, 99]
Out[6]=

Properties and Relations (3) 

The result returned by MultiplicativeDigitalRoot can be iteratively computed using NestWhileList:

In[7]:=
With[{n = RandomInteger[10^9], b = RandomInteger[{2, 20}]}, ResourceFunction["MultiplicativeDigitalRoot"][n, b] == NestWhileList[Times @@ IntegerDigits[#] &, n, # >= b &][[-1]]]
Out[7]=

The number of iterations required to reach the end of the digit multiplication process is called the multiplicative persistence and is returned by the resource function MultiplicativePersistence:

In[8]:=
n = RandomInteger[10^7]
Out[8]=
In[9]:=
list = NestWhileList[Times @@ IntegerDigits[#] &, n, # >= 10 &]
Out[9]=
In[10]:=
ResourceFunction["MultiplicativeDigitalRoot"][n] == list[[-1]]
Out[10]=
In[11]:=
ResourceFunction["MultiplicativePersistence"][n] == Length[list] - 1
Out[11]=

The additive analogue of the multiplicative digital root is called the additive digital root and is returned by the resource function AdditiveDigitalRoot:

In[12]:=
n = RandomInteger[10^7]
Out[12]=
In[13]:=
{add, mult} = Function[f, NestWhileList[f @@ IntegerDigits[#] &, n, # >= 10 &]] /@ {Plus, Times}
Out[13]=
In[14]:=
ResourceFunction["AdditiveDigitalRoot"][n] == add[[-1]]
Out[14]=

Possible Issues (1) 

MultiplicativeDigitalRoot requires its input to be non-negative:

In[15]:=
ResourceFunction["MultiplicativeDigitalRoot"][-234545]
Out[15]=

Neat Examples (1) 

Create a OEIS-themed table showing which integers have the same multiplicative digital root. This partially reproduces a cool result from the associated MathWorld article:

In[16]:=
Table[Shallow[
   Select[Range[0, 10000, 1], ResourceFunction["MultiplicativeDigitalRoot"][#] == n &]], {n, 0, 9, 1}] // Column
Out[16]=

Version History

  • 1.1.0 – 25 May 2023
  • 1.0.0 – 09 August 2022

Related Resources

Author Notes

As mentioned on the page Problems & Puzzles, Puzzle 341, there is a modified definition of multiplicative persistence due to Erdős wherein one only multiplies the nonzero digits at each step. This modification is not implemented herein but may be included in a future update.
In a future update, I'm going to make the "Neat Examples" table look better. That's definitely a version 2 edit!

License Information