Digital root

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

The digital root (also repeated digital sum) of a natural number in a given radix is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached. For example, in base 10, the digital root of the number 12345 is 6 because the sum of the digits in the number is 1 + 2 + 3 + 4 + 5 = 15, then the addition process is repeated again for the resulting number 15, so that the sum of 1 + 5 equals 6, which is the digital root of that number. In base 10, this is equivalent to taking the remainder upon division by 9 (except when the digital root is 9, where the remainder upon division by 9 will be 0), which allows it to be used as a divisibility rule.

Formal definition

[edit | edit source]

Let n be a natural number. For base b>1, we define the digit sum Fb: to be the following:

Fb(n)=i=0k1di

where k=logbn+1 is the number of digits in the number in base b, and

di=nmodbi+1nmodbibi

is the value of each digit of the number. A natural number n is a digital root if it is a fixed point for Fb, which occurs if Fb(n)=n.

All natural numbers n are preperiodic points for Fb, regardless of the base. This is because if nb, then

n=i=0k1dibi

and therefore

Fb(n)=i=0k1di<i=0k1dibi=n

because b>1. If n<b, then trivially

Fb(n)=n

Therefore, the only possible digital roots are the natural numbers 0n<b, and there are no cycles other than the fixed points of 0n<b.

Example

[edit | edit source]

In base 12, 8 is the additive digital root of the base 10 number 3110, as for n=3110

d0=3110mod120+13110mod120120=3110mod123110mod11=201=21=2
d1=3110mod121+13110mod121121=3110mod1443110mod1212=86212=8412=7
d2=3110mod122+13110mod122122=3110mod17283110mod144144=138286144=1296144=9
d3=3110mod123+13110mod123123=3110mod207363110mod17281728=311013821728=17281728=1
F12(3110)=i=041di=2+7+9+1=19

This process shows that 3110 is 1972 in base 12. Now for F12(3110)=19

d0=19mod120+119mod120120=19mod1219mod11=701=71=7
d1=19mod121+119mod121121=19mod14419mod1212=19712=1212=1
F12(19)=i=021di=1+7=8

shows that 19 is 17 in base 12. And as 8 is a 1-digit number in base 12,

F12(8)=8.

Direct formulas

[edit | edit source]

We can define the digit root directly for base b>1 drb: in the following ways:

Congruence formula

[edit | edit source]

The formula in base b is:

drb(n)={0if n=0,b1if n0, n 0(mod(b1)),nmod(b1)if n≢0(mod(b1))

or,

drb(n)={0if n=0,1 + ((n1)mod(b1))if n0.

In base 10, the corresponding sequence is (sequence A010888 in the OEIS).

The digital root is the value modulo (b1) because b1(mod(b1)), and thus bi1i1(mod(b1)). So regardless of the position i of digit di, dibidi(mod(b1)), which explains why digits can be meaningfully added. Concretely, for a three-digit number n=d2b2+d1b1+d0b0,

drb(n)d2b2+d1b1+d0b0d2(1)+d1(1)+d0(1)d2+d1+d0(mod(b1)).

To obtain the modular value with respect to other numbers m, one can take weighted sums, where the weight on the i-th digit corresponds to the value of bimodm. In base 10, this is simplest for m=2,5, and 10, where higher digits except for the unit digit vanish (since 2 and 5 divide powers of 10), which corresponds to the familiar fact that the divisibility of a decimal number with respect to 2, 5, and 10 can be checked by the last digit.

Also of note is the modulus m=b+1. Since b1(mod(b+1)), and thus b2(1)21(mod(b+1)), taking the alternating sum of digits yields the value modulo (b+1).

Using the floor function

[edit | edit source]

It helps to see the digital root of a positive integer as the position it holds with respect to the largest multiple of b1 less than the number itself. For example, in base 6 the digital root of 11 is 2, which means that 11 is the second number after 61=5. Likewise, in base 10 the digital root of 2035 is 1, which means that 20351=2034|9. If a number produces a digital root of exactly b1, then the number is a multiple of b1.

With this in mind the digital root of a positive integer n may be defined by using floor function x, as

drb(n)=n(b1)n1b1.

Properties

[edit | edit source]
  • The digital root of a1+a2 in base b is the digital root of the sum of the digital root of a1 and the digital root of a2: drb(a1+a2)=drb(drb(a1)+drb(a2)). This property can be used as a sort of checksum, to check that a sum has been performed correctly.
  • The digital root of a1a2 in base b is congruent to the difference of the digital root of a1 and the digital root of a2 modulo (b1): drb(a1a2)(drb(a1)drb(a2))(mod(b1)).
  • The digital root of n in base b is drb(n)drb(n)modb1.
  • The digital root of the product of nonzero single digit numbers a1a2 in base b is given by the Vedic Square in base b.
  • The digital root of a1a2 in base b is the digital root of the product of the digital root of a1 and the digital root of a2: drb(a1a2)=drb(drb(a1)drb(a2)).

Additive persistence

[edit | edit source]

The additive persistence counts how many times we must sum its digits to arrive at its digital root.

For example, the additive persistence of 2718 in base 10 is 2: first we find that 2 + 7 + 1 + 8 = 18, then that 1 + 8 = 9.

There is no limit to the additive persistence of a number in a number base b. Proof: For a given number n, the persistence of the number consisting of n repetitions of the digit 1 is 1 higher than that of n. The smallest numbers of additive persistence 0, 1, ... in base 10 are:

0, 10, 19, 199, 19 999 999 999 999 999 999 999, ... (sequence A006050 in the OEIS)

The next number in the sequence (the smallest number of additive persistence 5) is 2 × 102×(1022 − 1)/9 − 1 (that is, 1 followed by 2 222 222 222 222 222 222 222 nines). For any fixed base, the sum of the digits of a number is proportional to its logarithm; therefore, the additive persistence is proportional to the iterated logarithm.[1]

Programming example

[edit | edit source]

The example below implements the digit sum described in the definition above to search for digital roots and additive persistences in Java.

import java.util.HashSet;

public class DigitFunctions {

    // Sum of digits in base b
    static int digitSum(int x, int b) {
        int total = 0;
        while (x > 0) {
            total += x % b;
            x /= b;
        }
        return total;
    }

    // Digital root in base b
    static int digitalRoot(int x, int b) {
        HashSet<Integer> seen = new HashSet<>();
        while (!seen.contains(x)) {
            seen.add(x);
            x = digitSum(x, b);
        }
        return x;
    }

    // Additive persistence in base b
    static int additivePersistence(int x, int b) {
        HashSet<Integer> seen = new HashSet<>();
        while (!seen.contains(x)) {
            seen.add(x);
            x = digitSum(x, b);
        }
        return seen.size() - 1;
    }

    // Example usage
    public static void main(String[] args) {
        int x = 9876;
        int b = 10;

        System.out.println("Digit Sum: " + digitSum(x, b));
        System.out.println("Digital Root: " + digitalRoot(x, b));
        System.out.println("Additive Persistence: " + additivePersistence(x, b));
    }
}
[edit | edit source]

Digital roots are used in Western numerology, but certain numbers deemed to have occult significance (such as 11 and 22) are not always completely reduced to a single digit.

Digital roots form an important mechanic in the visual novel adventure game Nine Hours, Nine Persons, Nine Doors.

See also

[edit | edit source]

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). (online copy, p. 125, at Google Books)
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). (online copy, p. 68, at Google Books)
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). (online copy, p. 101, at Google Books)
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). (online copy, p. 53, at Google Books)
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value). (online copy at Google Books)
[edit | edit source]

de:Quersumme#Einstellige (oder iterierte) Quersumme