Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the additive digital root, in any base, of an integer
ResourceFunction["AdditiveDigitalRoot"][n,b] gives the additive digital root of the non-negative integer n when expressed in the base b. | |
ResourceFunction["AdditiveDigitalRoot"][n] gives the base-10 additive digital root of n. |
Compute the additive digital root of 1191:
In[1]:= | ![]() |
Out[1]= | ![]() |
Compute the additive digital root of 182, base-14 (note that the result has two digits base-10, but only a single base-14 digit):
In[2]:= | ![]() |
Out[2]= | ![]() |
AdditiveDigitalRoot threads elementwise over lists:
In[3]:= | ![]() |
Out[4]= | ![]() |
In[5]:= | ![]() |
Out[5]= | ![]() |
Compute the base-10 additive digital roots of the first 100 integers (OEIS A010888):
In[6]:= | ![]() |
Out[6]= | ![]() |
The additive digital root can be computed iteratively using NestWhile:
In[7]:= | ![]() |
Out[7]= | ![]() |
The additive digital root can be computed using Floor:
In[8]:= | ![]() |
Out[8]= | ![]() |
There is a well-known closed formula for the additive digital root in terms of Mod:
In[9]:= | ![]() |
Out[9]= | ![]() |
The number of iterations required to reach the end of the digit addition process is called the additive persistence and is returned by the resource function AdditivePersistence:
In[10]:= | ![]() |
Out[10]= | ![]() |
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
The multiplicative analogue of the additive digital root is called the multiplicative digital root and is returned by the resource function MultiplicativeDigitalRoot:
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
In[15]:= | ![]() |
Out[15]= | ![]() |
AdditiveDigitalRoot requires its input to be non-negative:
In[16]:= | ![]() |
Out[16]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License