6 kyu
Persistent Bugger.
72,002 of 207,904joh_pot
Description:
Write a function, persistence
, that takes in a positive parameter num
and returns its multiplicative persistence, which is the number of times you must multiply the digits in num
until you reach a single digit.
For example (Input --> Output):
39 --> 3 (because 3*9 = 27, 2*7 = 14, 1*4 = 4 and 4 has only one digit, there are 3 multiplications)
999 --> 4 (because 9*9*9 = 729, 7*2*9 = 126, 1*2*6 = 12, and finally 1*2 = 2, there are 4 multiplications)
4 --> 0 (because 4 is already a one-digit number, there is no multiplication)
Fundamentals
Mathematics
Similar Kata:
Stats:
Created | Aug 3, 2015 |
Published | Aug 3, 2015 |
Warriors Trained | 378048 |
Total Skips | 52839 |
Total Code Submissions | 662499 |
Total Times Completed | 207904 |
JavaScript Completions | 72002 |
Clojure Completions | 445 |
Ruby Completions | 5952 |
Python Completions | 75751 |
CoffeeScript Completions | 79 |
C# Completions | 12615 |
Java Completions | 20487 |
Haskell Completions | 1629 |
Elixir Completions | 554 |
Swift Completions | 1396 |
PHP Completions | 4567 |
F# Completions | 182 |
Kotlin Completions | 1681 |
Scala Completions | 657 |
C Completions | 3532 |
Julia Completions | 123 |
Rust Completions | 1892 |
Prolog Completions | 31 |
Pascal Completions | 31 |
COBOL Completions | 12 |
C++ Completions | 3868 |
TypeScript Completions | 2402 |
Crystal Completions | 18 |
Go Completions | 1296 |
Lua Completions | 159 |
Factor Completions | 10 |
D Completions | 10 |
Dart Completions | 100 |
Total Stars | 4613 |
% of votes with a positive feedback rating | 92% of 17609 |
Total "Very Satisfied" Votes | 14814 |
Total "Somewhat Satisfied" Votes | 2600 |
Total "Not Satisfied" Votes | 195 |