loading...

re: Turning 38 into 2: How to Solve the Add Digits Problem VIEW POST

FULL DISCUSSION
 

I would write this in js

const digitalRoot = (num)=>{
return num < 10 ? num:digitalRoot([...(num+"")].reduce((a,b)=>(+a)+(+b)))
}

 
code of conduct - report abuse