6 kyu
Persistent Bugger.
20,707 of 210,608joh_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 | 381922 |
Total Skips | 53111 |
Total Code Submissions | 668164 |
Total Times Completed | 210608 |
JavaScript Completions | 72772 |
Clojure Completions | 451 |
Ruby Completions | 5973 |
Python Completions | 76878 |
CoffeeScript Completions | 80 |
C# Completions | 12735 |
Java Completions | 20707 |
Haskell Completions | 1635 |
Elixir Completions | 558 |
Swift Completions | 1414 |
PHP Completions | 4608 |
F# Completions | 184 |
Kotlin Completions | 1707 |
Scala Completions | 661 |
C Completions | 3579 |
Julia Completions | 124 |
Rust Completions | 1935 |
Prolog Completions | 32 |
Pascal Completions | 31 |
COBOL Completions | 13 |
C++ Completions | 4050 |
TypeScript Completions | 2514 |
Crystal Completions | 19 |
Go Completions | 1344 |
Lua Completions | 167 |
Factor Completions | 10 |
D Completions | 12 |
Dart Completions | 133 |
OCaml Completions | 5 |
Total Stars | 4653 |
% of votes with a positive feedback rating | 92% of 17708 |
Total "Very Satisfied" Votes | 14897 |
Total "Somewhat Satisfied" Votes | 2613 |
Total "Not Satisfied" Votes | 198 |