/Persistence

Works out the persistence of a number.

Primary LanguageRuby

Persistence

Works out the multiplicative persistence of an integer.

This involves multiplying all digits of an integer by each other, repeating with the product until a single Digit is obtained. The number of steps required is known as the multiplicative persistence. For example, the sequence obtained from the starting number 9876 is (9876, 3024, 0), so 9876 has an multiplicative persistence of 2.

Thanks to:

https://archive.lib.msu.edu/crcmath/math/math/m/m443.htm

and wikipedia for the explanation.