Digit sum
Encyclopedia
In mathematics
, the digit sum of a given integer
is the sum
of all its digit
s, (e.g.: the digit sum of 84001 is calculated as 8+4+0+0+1 = 13). Digit sums are most often computed using the decimal
representation of the given number, but they may be calculated in any other base; different bases give different digit sums, with the digit sums for binary being on average smaller than those for any other base.
Let S(r,N) be the digit sum for radix r of all non-negative integers less than N. For any 2 ≤ r1 < r2 and for sufficiently large N,
S(r1,N) < S(r2,N).
The sum of the decimal digits of the integers 0, 1, 2, ... is given by in the On-Line Encyclopedia of Integer Sequences
. use the generating function
of this integer sequence (and of the analogous sequence for binary digit sums) to derive several rapidly-converging series
with rational
and transcendental
sums.
The concept of a decimal digit sum is closely related to, but not the same as, the digital root
, 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.
Digit sums are also a common ingredient in checksum
algorithms and were used in this way 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
s as a form of random number generation
; if one assumes that each digit is random, then by the central limit theorem
, these digit sums will have a random distribution closely approximating a Gaussian distribution.
The digit sum of the binary
representation of a number is known as its Hamming weight
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
, coding theory
, and computer chess
.
Harshad number
s are defined in terms of divisibility by their digit sums, and Smith number
s are defined by the equality of their digit sums with the digit sums of their prime factorizations.
studies the question of how many integers are mapped to the same value by the sum-of-digits function.
6% of the numbers below 100000 have a digit sum of 23, which is along with 22 the most common digit sum within this limit.
Mathematics
Mathematics is the study of quantity, space, structure, and change. Mathematicians seek out patterns and formulate new conjectures. Mathematicians resolve the truth or falsity of conjectures by mathematical proofs, which are arguments sufficient to convince other mathematicians of their validity...
, the digit sum of a given integer
Integer
The integers are formed by the natural numbers together with the negatives of the non-zero natural numbers .They are known as Positive and Negative Integers respectively...
is the sum
Addition
Addition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign . For example, in the picture on the right, there are 3 + 2 apples—meaning three apples and two other apples—which is the same as five apples....
of all its digit
Numerical digit
A digit is a symbol used in combinations to represent numbers in positional numeral systems. The name "digit" comes from the fact that the 10 digits of the hands correspond to the 10 symbols of the common base 10 number system, i.e...
s, (e.g.: the digit sum of 84001 is calculated as 8+4+0+0+1 = 13). Digit sums are most often computed using the decimal
Decimal
The decimal numeral system has ten as its base. It is the numerical base most widely used by modern civilizations....
representation of the given number, but they may be calculated in any other base; different bases give different digit sums, with the digit sums for binary being on average smaller than those for any other base.
Let S(r,N) be the digit sum for radix r of all non-negative integers less than N. For any 2 ≤ r1 < r2 and for sufficiently large N,
S(r1,N) < S(r2,N).
The sum of the decimal digits of the integers 0, 1, 2, ... is given by in the On-Line Encyclopedia of Integer Sequences
On-Line Encyclopedia of Integer Sequences
The On-Line Encyclopedia of Integer Sequences , also cited simply as Sloane's, is an online database of integer sequences, created and maintained by N. J. A. Sloane, a researcher at AT&T Labs...
. use the generating function
Generating function
In mathematics, a generating function is a formal power series in one indeterminate, whose coefficients encode information about a sequence of numbers an that is indexed by the natural numbers. Generating functions were first introduced by Abraham de Moivre in 1730, in order to solve the general...
of this integer sequence (and of the analogous sequence for binary digit sums) to derive several rapidly-converging series
Series (mathematics)
A series is the sum of the terms of a sequence. Finite sequences and series have defined first and last terms, whereas infinite sequences and series continue indefinitely....
with rational
Rational number
In mathematics, a rational number is any number that can be expressed as the quotient or fraction a/b of two integers, with the denominator b not equal to zero. Since b may be equal to 1, every integer is a rational number...
and transcendental
Transcendental number
In mathematics, a transcendental number is a number that is not algebraic—that is, it is not a root of a non-constant polynomial equation with rational coefficients. The most prominent examples of transcendental numbers are π and e...
sums.
The concept of a decimal digit sum is closely related to, but not the same as, the digital root
Digital root
The digital root of a number is the value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum...
, 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
Divisibility rule
A divisibility rule is a shorthand way of discovering whether a given number is divisible by a fixed divisor without performing the division, usually by examining its digits...
: 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.
Digit sums are also a common ingredient in checksum
Checksum
A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and...
algorithms and were used in this way 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
Logarithm
The logarithm of a number is the exponent by which another fixed value, the base, has to be raised to produce that number. For example, the logarithm of 1000 to base 10 is 3, because 1000 is 10 to the power 3: More generally, if x = by, then y is the logarithm of x to base b, and is written...
s as a form of random number generation
Random number generation
A random number generator ) is a computational or physical device designed to generate a sequence of numbers or symbols that lack any pattern, i.e. appear random....
; if one assumes that each digit is random, then by the central limit theorem
Central limit theorem
In probability theory, the central limit theorem states conditions under which the mean of a sufficiently large number of independent random variables, each with finite mean and variance, will be approximately normally distributed. The central limit theorem has a number of variants. In its common...
, these digit sums will have a random distribution closely approximating a Gaussian distribution.
The digit sum of the binary
Binary numeral system
The binary numeral system, or base-2 number system, represents numeric values using two symbols, 0 and 1. More specifically, the usual base-2 system is a positional notation with a radix of 2...
representation of a number is known as its Hamming weight
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 of bits, this is the number of 1's in the string...
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
Cryptography is the practice and study of techniques for secure communication in the presence of third parties...
, coding theory
Coding theory
Coding theory is the study of the properties of codes and their fitness for a specific application. Codes are used for data compression, cryptography, error-correction and more recently also for network coding...
, and computer chess
Computer chess
Computer chess is computer architecture encompassing hardware and software capable of playing chess autonomously without human guidance. Computer chess acts as solo entertainment , as aids to chess analysis, for computer chess competitions, and as research to provide insights into human...
.
Harshad number
Harshad number
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 were defined by D. R. Kaprekar, a mathematician from India. The word "Harshad" comes from the Sanskrit + , meaning joy-giver. The Niven...
s are defined in terms of divisibility by their digit sums, and Smith number
Smith number
A Smith number is a composite number for which, in a given base , the sum of its digits is equal to the sum of the digits in its prime factorization. For example, 378 = 2 × 3 × 3 × 3 × 7 is a Smith number since 3 + 7 + 8 =...
s are defined by the equality of their digit sums with the digit sums of their prime factorizations.
studies the question of how many integers are mapped to the same value by the sum-of-digits function.
6% of the numbers below 100000 have a digit sum of 23, which is along with 22 the most common digit sum within this limit.