|
|||||||||||||||||
![]() |
![]() |
![]() |
|||||||||||||||
Visit Tutorials below:
|
What is Digital Root? Think of any positive integer number, for example 179. Add all the digits of that number (1 + 7 + 9 = 17). Repeat the addition of the digits until it is only single digit (thus, 17 -> 1 + 7 = 8). The last single digit is called digital root of the number. Thus, digital root of 179 is 8. Digital root or sometimes called digit sum of a positive integer number is a single digit obtained from the iterative summation of the digits in the number. For our base-10 decimal system, the single digit is one of number 1 to 9. Digital root of a number can be computed using the following formula
Thus, the simplest Macro to obtain digital root is Function DigitRoot(num As Integer) As Integer In many programming languages, Mod function has limitation to take argument up to 9 digits number. From number theory, we know that Modulus function, which gives the remainder of a division, has relationship with floor function
Then, the simple Macro to obtain digital root is Function DigitalRoot(num as Variant) As Integer Note however the functions above cannot handle very large number. For example if you use num = 25^25 and use MS Excel (or even Visual Basic), you cannot get the digital root using the formula or simple macro above. [See also the section Power of Digital Root]. If you like iterative programming of digital root of large number, you should check the function below. Optionally, this function also gives the additive persistence value, which is the number of times to transform the original number into digital root. The number of digit input is also not limited only up to 9 or 28 digits as the code above but much higher number of digits (note that double floating point in VB can cover only 324 digits). The idea is to put the inputNum as a sequence of string rather than a number.
Function DigitalRoot(inputNum As Variant, Optional AdditivePersistence As Integer) As Integer The number of transformation from the number until digital root is called additive persistence . For number 179 we have additive persistence of 2 because it requires 2 transformations from 179 -> 17 -> 8. Another example, number 78945 is transformed into 33 (=7+8+9+4+5) and finally transformed into 6 (=3+3). Thus, 78945 -> 33 -> 6 has additive persistence of 2. Note that the above digital root function has limited up to 309 digits because of VBA function IsNumeric(x). If you are sure that the input value is Numeric, you can remove the validation line and theoretically you can obtain the digital root of any digit number limited only by your computer memory or other factors. In fact, the stress testing in my computer can run the digital root code above only up to 32,759 digits. Digital root calculatorBelow is Digital root calculator, an interactive program to determine the digital root of your input. Test your own input of digital root. Your input must be positive integer number of any digit up to 65,513 digits. The Example button will provide you with a random number of 15 to 16 digits input. You may play around with large number of digits input. These tutorial is copyrighted. Preferable reference for this tutorial is Teknomo, Kardi (2005). Digital Root. http:\\people.revoledu.com\kardi\tutorial\DigitSum\ |
||||||||||||||
|
|||||||||||||||
|
|||||||||||||||