The digital root (also repeated digital sum) of a
natural number
In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country").
Numbers used for counting are called ''Cardinal n ...
in a given
radix
In a positional numeral system, the radix or base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal/denary system (the most common system in use today) the radix (base number) is t ...
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
A divisibility rule is a shorthand and useful way of determining whether a given integer is divisible by a fixed divisor without performing the division, usually by examining its digits. Although there are divisibility tests for numbers in any rad ...
.
Formal definition
Let
be a natural number. For base
, we define the
digit sum
In mathematics, the digit sum of a natural number in a given number base is the sum of all its digits. For example, the digit sum of the decimal number 9045 would be 9 + 0 + 4 + 5 = 18.
Definition
Let n be a natural number. We define the digit ...
to be the following:
:
where
is the number of digits in the number in base
, and
:
is the value of each digit of the number. A natural number
is a digital root if it is a
fixed point for
, which occurs if
.
All natural numbers
are
preperiodic points for
, regardless of the base. This is because if
, then
:
and therefore
:
because
.
If
, then trivially
:
Therefore, the only possible digital roots are the natural numbers
, and there are no cycles other than the fixed points of
.
Example
In
base 12
The duodecimal system (also known as base 12, dozenal, or, rarely, uncial) is a positional notation numeral system using twelve as its base. The number twelve (that is, the number written as "12" in the decimal numerical system) is instead writ ...
, 8 is the additive digital root of the
base 10
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numer ...
number 3110, as for
:
:
:
:
:
This process shows that 3110 is 1972 in
base 12
The duodecimal system (also known as base 12, dozenal, or, rarely, uncial) is a positional notation numeral system using twelve as its base. The number twelve (that is, the number written as "12" in the decimal numerical system) is instead writ ...
. Now for
:
:
:
shows that 19 is 17 in
base 12
The duodecimal system (also known as base 12, dozenal, or, rarely, uncial) is a positional notation numeral system using twelve as its base. The number twelve (that is, the number written as "12" in the decimal numerical system) is instead writ ...
. And as 8 is a 1-digit number in
base 12
The duodecimal system (also known as base 12, dozenal, or, rarely, uncial) is a positional notation numeral system using twelve as its base. The number twelve (that is, the number written as "12" in the decimal numerical system) is instead writ ...
,
:
Direct formulas
We can define the digit root directly for base
in the following ways:
Congruence formula
The formula in base
is:
:
or,
:
In
base 10
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numer ...
, the corresponding sequence is .
The digital root is the value modulo
because
and thus
so regardless of position, the value
is the same –
– which is why digits can be meaningfully added. Concretely, for a three-digit number
:
.
To obtain the modular value with respect to other numbers
, one can take
weighted sum
A weight function is a mathematical device used when performing a sum, integral, or average to give some elements more "weight" or influence on the result than other elements in the same set. The result of this application of a weight function is ...
s, where the weight on the
-th digit corresponds to the value of
modulo
. In
base 10
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numer ...
, this is simplest for 2, 5, and 10, where higher digits vanish (since 2 and 5 divide 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 (even numbers end in 0, 2, 4, 6, or 8).
Also of note is the modulus
: since
and thus
taking the ''alternating'' sum of digits yields the value modulo
.
Using the floor function
It helps to see the digital root of a positive integer as the position it holds with respect to the largest multiple of
less than the number itself. For example, in
base 6
A senary () numeral system (also known as base-6, heximal, or seximal) has six as its base. It has been adopted independently by a small number of cultures. Like decimal, it is a semiprime, though it is unique as the product of the only two con ...
the digital root of 11 is 2, which means that 11 is the second number after
. Likewise, in base 10 the digital root of 2035 is 1, which means that
. If a number produces a digital root of exactly
, then the number is a multiple of
.
With this in mind the digital root of a positive integer
may be defined by using
floor function
In mathematics and computer science, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least int ...
, as
:
Properties
* The digital root of
in base
is the digital root of the sum of the digital root of
and the digital root of
. This property can be used as a sort of
checksum
A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data ...
, to check that a sum has been performed correctly.
:
* The digital root of
in base
is congruent to the difference of the digital root of
and the digital root of
modulo
.
:
* The digital root of
in base
as follows:
:
* The digital root of the product of nonzero single digit numbers
in base
is given by the
Vedic Square
In Indian mathematics, a Vedic square is a variation on a typical 9 × 9 multiplication table where the entry in each cell is the digital root of the product of the column and row headings i.e. the remainder when the product of the ...
in base
.
* The digital root of
in base
is the digital root of the product of the digital root of
and the digital root of
.
:
Additive persistence
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
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numer ...
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
. Proof: For a given number
, the persistence of the number consisting of
repetitions of the digit 1 is 1 higher than that of
. The smallest numbers of additive persistence 0, 1, ... in base 10 are:
:0, 10, 19, 199, 19 999 999 999 999 999 999 999, ...
The next number in the sequence (the smallest number of additive persistence 5) is 2 × 10
2×(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
In mathematics, the logarithm is the inverse function to exponentiation. That means the logarithm of a number to the base is the exponent to which must be raised, to produce . For example, since , the ''logarithm base'' 10 o ...
; therefore, the additive persistence is proportional to the
iterated logarithm
In computer science, the iterated logarithm of n, written n (usually read "log star"), is the number of times the logarithm function must be iteratively applied before the result is less than or equal to 1. The simplest formal definition i ...
.
Programming example
The example below implements the digit sum described in the definition above to search for digital roots and additive persistences in
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
.
def digit_sum(x: int, b: int) -> int:
total = 0
while x > 0:
total = total + (x % b)
x = x // b
return total
def digital_root(x: int, b: int) -> int:
seen = set()
while x not in seen:
seen.add(x)
x = digit_sum(x, b)
return x
def additive_persistence(x: int, b: int) -> int:
seen = set()
while x not in seen:
seen.add(x)
x = digit_sum(x, b)
return len(seen) - 1
In popular culture
Digital roots are used in Western
numerology
Numerology (also known as arithmancy) is the belief in an occult, divine or mystical relationship between a number and one or more coinciding events. It is also the study of the numerical value, via an alphanumeric system, of the letters in ...
, 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
''Nine Hours, Nine Persons, Nine Doors'' is a visual novel and adventure video game developed by Chunsoft. It is the first installment in the ''Zero Escape'' series, and was released in Japan in December 2009 and in North America in November 2 ...
''.
See also
*
Arithmetic dynamics Arithmetic dynamics is a field that amalgamates two areas of mathematics, dynamical systems and number theory. Classically, discrete dynamics refers to the study of the iteration of self-maps of the complex plane or real line. Arithmetic dynamics is ...
*
Base 9
A ternary numeral system (also called base 3 or trinary) has three as its base. Analogous to a bit, a ternary digit is a trit (trinary digit). One trit is equivalent to log2 3 (about 1.58496) bits of information.
Although ''ternary'' ...
*
Casting out nines
Casting out nines is any of three arithmetical procedures:
*Adding the decimal digits of a positive whole number, while optionally ignoring any 9s or digits which sum to a multiple of 9. The result of this procedure is a number which is smaller th ...
*
Digit sum
In mathematics, the digit sum of a natural number in a given number base is the sum of all its digits. For example, the digit sum of the decimal number 9045 would be 9 + 0 + 4 + 5 = 18.
Definition
Let n be a natural number. We define the digit ...
*
Divisibility rule
A divisibility rule is a shorthand and useful way of determining whether a given integer is divisible by a fixed divisor without performing the division, usually by examining its digits. Although there are divisibility tests for numbers in any rad ...
*
Hamming weight
The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from the all-zero string of the same length. For the most typical case, a string o ...
*
Multiplicative digital root
In number theory, the multiplicative digital root of a natural number n in a given number base b is found by multiplying the digits of n together, then repeating this operation until only a single-digit remains, which is called the multiplicati ...
References
* ()
* ()
* ()
* ()
* ()
External links
Patterns of digital roots using MS Excel*
{{Classes of natural numbers
Algebra
Arithmetic dynamics
Base-dependent integer sequences
Number theory
de:Quersumme#Einstellige (oder iterierte) Quersumme