I’m a newbie to Mathematica (having played with it for just three days), so apologies for what might seem a dumb question. I can’t find anywhere (even in the Help) a function for calculating the digital sum and the digital root of an integer. I can do it programmatically, but surely there is a built-in function or command for these common digit-manipulation tasks.
Cheers
FixedPoint will repeatedly apply digitalSum until the result does not change. A more explicit implementation could use NestWhile, with a check on the number of digits. But this trick with FixedPoint makes the code shorter.
Thank you Szabolcs, Paul and Sander. This all works perfectly. I am intrigued by “offset”. The accompanying documentation doesn’t explain how it affects mod calculations. It works, but it puzzles me.
Cheers
Geoffrey