The basic definition and nature of digital root can be found in the reference to Wikipedia.
First, the definition
The digital root is the addition of a number of numbers, plus the number of the numbers, until the number is one digit. And this one number is the digital root of the original number. The applicable range is positive integers and 0. For example: 65536,6+5+5+3+6=25,2+5=7, so the number root is 7.
Second, the Nature
1. Any number plus minus 9 is the root of it itself.
2.9 times the number root of any number is 9.
3. Three operations of the number root
(1). The number root of the sum of two numbers is equal to the number root of these two numbers.
(2). The number root of the product of two numbers is equal to the sum of the numbers of the two number roots.
(3). The number root of a number's n power is equal to the number root of the number root of n times
Three, the formula of finding the number
Digital root = (DIGITAL-1) MoD 9 + 1
Iv. implementation of Java
Public class Solution { publicint adddigits (int num) { int result = (num-1)%9 + 1; return result;} }
Digital root (digital root)