6 kyu
Persistent Bugger.
71,704 of 206,894joh_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 | 376617 |
Total Skips | 52722 |
Total Code Submissions | 660357 |
Total Times Completed | 206894 |
JavaScript Completions | 71704 |
Clojure Completions | 444 |
Ruby Completions | 5946 |
Python Completions | 75306 |
CoffeeScript Completions | 79 |
C# Completions | 12570 |
Java Completions | 20427 |
Haskell Completions | 1626 |
Elixir Completions | 553 |
Swift Completions | 1392 |
PHP Completions | 4548 |
F# Completions | 182 |
Kotlin Completions | 1672 |
Scala Completions | 657 |
C Completions | 3515 |
Julia Completions | 123 |
Rust Completions | 1879 |
Prolog Completions | 31 |
Pascal Completions | 30 |
COBOL Completions | 12 |
C++ Completions | 3817 |
TypeScript Completions | 2371 |
Crystal Completions | 18 |
Go Completions | 1281 |
Lua Completions | 156 |
Factor Completions | 10 |
D Completions | 10 |
Dart Completions | 95 |
Total Stars | 4606 |
% of votes with a positive feedback rating | 92% of 17577 |
Total "Very Satisfied" Votes | 14785 |
Total "Somewhat Satisfied" Votes | 2599 |
Total "Not Satisfied" Votes | 193 |