Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the additive persistence, in any base, of an integer
ResourceFunction["AdditivePersistence"][n,b] gives the additive persistence of the non-negative integer n when expressed in the base b. | |
ResourceFunction["AdditivePersistence"][n] gives the base-10 additive persistence of n. |
Find the additive persistence of 1191:
In[1]:= |
Out[1]= |
Carrying out the iterated digit sum confirms this result:
In[2]:= |
Out[2]= |
Compute the additive digital root of 1899, base-14:
In[3]:= |
Out[3]= |
AdditivePersistence threads elementwise over lists:
In[4]:= |
Out[5]= |
In[6]:= |
Out[6]= |
Compute the additive persistence of the first 100 integers (OEIS A031286):
In[7]:= |
Out[7]= |
The result returned by AdditivePersistence can be iteratively computed using NestWhileList:
In[8]:= |
Out[8]= |
The single-digit integer that marks the end of the digit addition process is called the additive digital root and is returned by the resource function AdditiveDigitalRoot:
In[9]:= |
Out[9]= |
In[10]:= |
Out[10]= |
In[11]:= |
Out[11]= |
In[12]:= |
Out[12]= |
The multiplicative analogue of additive persistence is called multiplicative persistence and is returned by the resource function MultiplicativePersistence:
In[13]:= |
Out[13]= |
In[14]:= |
Out[14]= |
In[15]:= |
Out[15]= |
AdditivePersistence requires its input to be non-negative:
In[16]:= |
Out[16]= |
The smallest integers with (base-10) additive persistences equal to 0,1,2,3,4,… (OEIS A006050) are:
In[17]:= |
Out[17]= |
The smallest integer with additive persistence 5 is known to equal 1 followed by 2222222222222222222222 9’s.
This work is licensed under a Creative Commons Attribution 4.0 International License