6 kyu
Persistent Bugger.
72,277 of 208,867joh_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 | 379492 |
Total Skips | 52926 |
Total Code Submissions | 664528 |
Total Times Completed | 208867 |
JavaScript Completions | 72277 |
Clojure Completions | 447 |
Ruby Completions | 5957 |
Python Completions | 76162 |
CoffeeScript Completions | 80 |
C# Completions | 12649 |
Java Completions | 20576 |
Haskell Completions | 1631 |
Elixir Completions | 555 |
Swift Completions | 1404 |
PHP Completions | 4579 |
F# Completions | 183 |
Kotlin Completions | 1685 |
Scala Completions | 658 |
C Completions | 3555 |
Julia Completions | 124 |
Rust Completions | 1905 |
Prolog Completions | 32 |
Pascal Completions | 31 |
COBOL Completions | 13 |
C++ Completions | 3932 |
TypeScript Completions | 2439 |
Crystal Completions | 19 |
Go Completions | 1312 |
Lua Completions | 163 |
Factor Completions | 10 |
D Completions | 12 |
Dart Completions | 112 |
Total Stars | 4624 |
% of votes with a positive feedback rating | 92% of 17640 |
Total "Very Satisfied" Votes | 14842 |
Total "Somewhat Satisfied" Votes | 2603 |
Total "Not Satisfied" Votes | 195 |