Recursive Digit Sum

  • + 0 comments

    Typescript Solution

       if (n.length === 1) {
            return +n;
        }
        let sum: number = n.split('')
        .reduce((a, b) => { 
            return +a + +b 
        }, 0);    
        sum *= k;
        
        return superDigit(sum.toString(), 1) ;