Skip to content

Instantly share code, notes, and snippets.

@f3r
Created November 13, 2015 02:30
Show Gist options
  • Save f3r/4361f33c8033ed8e1345 to your computer and use it in GitHub Desktop.
Save f3r/4361f33c8033ed8e1345 to your computer and use it in GitHub Desktop.
Mu
// http://mathworld.wolfram.com/MultiplicativePersistence.html
var prod = function(num){
return num.toString().split('').reduce(function(prev, cur){
return prev*cur;
})
}
var mp = function(num) {
if (num < 10) { return 0 }
else { return 1 + mp(prod(num)) }
}
mp(39);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment