6 kyu
Persistent Bugger.
75,987 of 208,447joh_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 | 378793 |
Total Skips | 52899 |
Total Code Submissions | 663670 |
Total Times Completed | 208447 |
JavaScript Completions | 72168 |
Clojure Completions | 446 |
Ruby Completions | 5956 |
Python Completions | 75987 |
CoffeeScript Completions | 79 |
C# Completions | 12636 |
Java Completions | 20534 |
Haskell Completions | 1629 |
Elixir Completions | 554 |
Swift Completions | 1400 |
PHP Completions | 4572 |
F# Completions | 182 |
Kotlin Completions | 1682 |
Scala Completions | 657 |
C Completions | 3545 |
Julia Completions | 123 |
Rust Completions | 1896 |
Prolog Completions | 31 |
Pascal Completions | 31 |
COBOL Completions | 12 |
C++ Completions | 3892 |
TypeScript Completions | 2418 |
Crystal Completions | 18 |
Go Completions | 1303 |
Lua Completions | 161 |
Factor Completions | 10 |
D Completions | 10 |
Dart Completions | 106 |
Total Stars | 4621 |
% of votes with a positive feedback rating | 92% of 17623 |
Total "Very Satisfied" Votes | 14826 |
Total "Somewhat Satisfied" Votes | 2602 |
Total "Not Satisfied" Votes | 195 |