In
mathematics, the digit 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 ...
in a given
number base is the
sum
Sum most commonly means the total of two or more numbers added together; see addition.
Sum can also refer to:
Mathematics
* Sum (category theory), the generic concept of summation in mathematics
* Sum, the result of summation, the additio ...
of all its
digit
Digit may refer to:
Mathematics and science
* Numerical digit, as used in mathematics or computer science
** Hindu-Arabic numerals, the most common modern representation of numerical digits
* Digit (anatomy), the most distal part of a limb, such ...
s. For example, the digit sum of the
decimal number
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 numera ...
would be
.
Definition
Let
be a natural number. We define the digit sum for base
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.
For example, in base 10, the digit sum of 84001 is
.
For any two bases
and for sufficiently large natural numbers
,
:
.
[.]
The sum 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 numeral ...
digits of the integers 0, 1, 2, ... is given by in the
On-Line Encyclopedia of Integer Sequences
The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It was created and maintained by Neil Sloane while researching at AT&T Labs. He transferred the intellectual property and hosting of the OEIS to ...
. use the
generating function
In mathematics, a generating function is a way of encoding an infinite sequence of numbers () by treating them as the coefficients of a formal power series. This series is called the generating function of the sequence. Unlike an ordinary ser ...
of this integer sequence (and of the analogous sequence for binary digit sums) to derive several rapidly converging
series with
rational
Rationality is the quality of being guided by or based on reasons. In this regard, a person acts rationally if they have a good reason for what they do or a belief is rational if it is based on strong evidence. This quality can apply to an abil ...
and
transcendental
Transcendence, transcendent, or transcendental may refer to:
Mathematics
* Transcendental number, a number that is not the root of any polynomial with rational coefficients
* Algebraic element or transcendental element, an element of a field exten ...
sums.
Extension to negative integers
The digit sum can be extended to the negative integers by use of a
signed-digit representation
In mathematical notation for numbers, a signed-digit representation is a positional numeral system with a set of signed digits used to encode the integers.
Signed-digit representation can be used to accomplish fast addition of integers because ...
to represent each integer.
Applications
The concept of a decimal digit sum is closely related to, but not the same as, the
digital root
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 s ...
, which is the result of repeatedly applying the digit sum operation until the remaining value is only a single digit. The digital root of any non-zero integer will be a number in the range 1 to 9, whereas the digit sum can take any value. Digit sums and digital roots can be used for quick
divisibility tests: a natural number is divisible by 3 or 9 if and only if its digit sum (or digital root) is divisible by 3 or 9, respectively. For divisibility by 9, this test is called the rule of nines and is the basis of the
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 ...
technique for checking calculations.
Digit sums are also a common ingredient in
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 dat ...
algorithms to check the arithmetic operations of early computers. Earlier, in an era of hand calculation, suggested using sums of 50 digits taken from mathematical tables of
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 of ...
s as a form of
random number generation
Random number generation is a process by which, often by means of a random number generator (RNG), a sequence of numbers or symbols that cannot be reasonably predicted better than by random chance is generated. This means that the particular outc ...
; if one assumes that each digit is random, then by the
central limit theorem
In probability theory, the central limit theorem (CLT) establishes that, in many situations, when independent random variables are summed up, their properly normalized sum tends toward a normal distribution even if the original variables thems ...
, these digit sums will have a random distribution closely approximating a
Gaussian distribution
In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is
:
f(x) = \frac e^
The parameter \mu i ...
.
[.]
The digit sum of the
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two digits (0 and 1)
* Binary function, a function that takes two arguments
* Binary operation, a mathematical operation that ta ...
representation of a number is known as its
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 ...
or population count; algorithms for performing this operation have been studied, and it has been included as a built-in operation in some computer architectures and some programming languages. These operations are used in computing applications including
cryptography
Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adve ...
,
coding theory
Coding theory is the study of the properties of codes and their respective fitness for specific applications. Codes are used for data compression, cryptography, error detection and correction, data transmission and data storage. Codes are stud ...
, and
computer chess
Computer chess includes both hardware (dedicated computers) and software capable of playing chess. Computer chess provides opportunities for players to practice even in the absence of human opponents, and also provides opportunities for analysi ...
.
Harshad number
In mathematics, a harshad number (or Niven number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.
Harshad numbers in base are also known as -harshad (or -Niven) numbers.
Harshad numbe ...
s are defined in terms of divisibility by their digit sums, and
Smith number
In number theory, a Smith number is a composite number for which, in a given number base, the sum of its digits is equal to the sum of the digits in its prime factorization in the given number base. In the case of numbers that are not square-f ...
s are defined by the equality of their digit sums with the digit sums of their
prime factorizations.
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 ...
*
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 ...
*
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 dat ...
*
Digital root
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 s ...
*
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 ...
*
Harshad number
In mathematics, a harshad number (or Niven number) in a given number base is an integer that is divisible by the sum of its digits when written in that base.
Harshad numbers in base are also known as -harshad (or -Niven) numbers.
Harshad numbe ...
*
Perfect digital invariant In number theory, a perfect digital invariant (PDI) is a number in a given number base (b) that is the sum of its own digits each raised to a given power (p). 0 F_ : \mathbb \rightarrow \mathbb is defined as:
:F_(n) = \sum_^ d_i^p.
where k = \lfl ...
*
Sideways sum
''Sideways'' is a 2004 American comedy-drama road film directed by Alexander Payne and written by Jim Taylor and Payne. A film adaptation of Rex Pickett's 2004 novel of the same name, ''Sideways'' follows two men in their forties, Miles Raymon ...
*
Smith number
In number theory, a Smith number is a composite number for which, in a given number base, the sum of its digits is equal to the sum of the digits in its prime factorization in the given number base. In the case of numbers that are not square-f ...
*
Sum-product number
A sum-product number in a given number base b is a natural number that is equal to the product of the sum of its digits and the product of its digits.
There are a finite number of sum-product numbers in any given base b. 1 F_ : \mathbb \rightarr ...
References
External links
*
Simple applications of digit sum
{{Classes of natural numbers
Addition
Arithmetic dynamics
Base-dependent integer sequences
Number theory