You are viewing a single comment's thread. Return to all comments →
Javascript Solution Easy Approach: Sum the individual N first then mult by K, instead of concate the N for K times.
function superDigit(n, k) { if(n.toString().length == 1) return n; let p = n.toString().split("").reduce((a, b) => parseInt(a) + parseInt(b)) * k; return superDigit(p, 1); }
Seems like cookies are disabled on this browser, please enable them to open this website
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
Javascript Solution Easy Approach: Sum the individual N first then mult by K, instead of concate the N for K times.