Have the function MultiplicativePersistence(num) take the num parameter being passed which will always be a positive integer and return its multiplicative persistence which is the number of times you must multiply the digits in num until you reach a single digit.
For example: if num is 39 then your program should return 3 because 3 * 9 = 27 then 2 * 7 = 14 and finally 1 * 4 = 4 and you stop at
Multiplicative Persistence Java
Multiplicative Persistence Python
Multiplicative Persistence Javascript
Using the JavaScript language, have the function FirstFactorial(num) take the num parameter being passed and return the factorial of it (ie. if num = 4, return (4 * 3 * 2 * 1)). For the test cases, the range will be between 1 and 18.
Explanation
The challenge passes a string but it expects us to do Math on it so it needs to be converted to numbers. I will use the base 10 parameter of the toString() function to convert each entry in the array to a Number. Then I am going to multiply each entry in the array to get a total. I will repeat this until my total is a single digit number. The number of times I multiplied is returned as the answer.
Disclaimer: The above Problem is generated by Coderbyte but the Solution is provided by ShouterFolk.