# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Compute the multiplicative persistence of an integer

Contributed by:
Christopher Stover

ResourceFunction["MultiplicativePersistence"][ returns the multiplicative persistence of |

Starting with a non-negative integer *n*, multiply its digits, then multiply the digits of the resulting number, etc., until the result has only one digit. The number of multiplications required to reach the single digit stopping point is called the multiplicative persistence of *n*.

As an example, 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 it took three steps to reach the stopping point, ResourceFunction["MultiplicativePersistence"][14691] returns 3.

The multiplicative persistence of a number is also sometimes called its number length.

ResourceFunction["MultiplicativePersistence"] threads elementwise over lists.

Compute the multiplicative persistence of 14691:

In[1]:= |

Out[1]= |

MultiplicativePersistence threads elementwise over lists:

In[2]:= |

Out[2]= |

Compute the multiplicative persistence of the first 100 integers (OEIS A031346):

In[3]:= |

Out[3]= |

The result returned by MultiplicativePersistence can be manually computed using Length with NestWhileList:

In[4]:= |

Out[4]= |

The multiplicative persistence of an integer can also be manually computed with no high-level functions:

In[5]:= |

Out[5]= |

In[6]:= |

Out[6]= |

In[7]:= |

Out[7]= |

In[8]:= |

Out[8]= |

In[9]:= |

Out[9]= |

Because *testint3* is a single-digit integer, the process terminates here. Since it took two steps to reach *testint3*, the multiplicative persistence of *testint1*=1234 is equal to 2:

In[10]:= |

Out[10]= |

The single-digit integer that marks the end of the digit multiplication process is called the multiplicative digital root and is returned by the resource function MultiplicativeDigitalRoot:

In[11]:= |

Out[11]= |

In[12]:= |

Out[12]= |

In[13]:= |

Out[13]= |

In[14]:= |

Out[14]= |

The additive analogue of multiplicative persistence is called additive persistence and is returned by the resource function AdditivePersistence:

In[15]:= |

Out[15]= |

In[16]:= |

Out[16]= |

In[17]:= |

Out[17]= |

In[18]:= |

Out[18]= |

MultiplicativePersistence requires its input to be non-negative:

In[19]:= |

Out[19]= |

The smallest integers with multiplicative persistence equal to 0,1,2,3,4,… (OEIS A003001):

In[20]:= |

Out[20]= |

It is known that there is no number *N*<10^{233} with multiplicative persistence larger than 11 (Carmody 2001).

- Multiplicative Persistence–Wolfram MathWorld
- Wikipedia–Persistence of a number
- Puzzle 341. Multiplicative persistence, Erdos style–The Prime Puzzles & Problems Connection

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

This work is licensed under a Creative Commons Attribution 4.0 International License