digit sum
{{Short description|Sum of a number's digits}}
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 would be
Definition
Let be a natural number. We define the digit sum for base , to be the following:
:
where is one less than 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
:{{citation|doi=10.2307/2304217|first=L. E.|last=Bush|title=An asymptotic formula for the average sum of the digits of integers|journal=American Mathematical Monthly|year=1940|volume=47|issue=3|pages=154–156|publisher=Mathematical Association of America|jstor=2304217}}.
The sum of the base 10 digits of the integers 0, 1, 2, ... is given by {{OEIS2C|id=A007953}} in the On-Line Encyclopedia of Integer Sequences. {{harvtxt|Borwein|Borwein|1992}} 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.{{citation|doi=10.2307/2324993|title=Strange series and high precision fraud|first1=J. M.|last1=Borwein|author1-link=Jonathan Borwein|first2=P. B.|last2=Borwein|author2-link=Peter Borwein|journal=American Mathematical Monthly|volume=99|issue=7|year=1992|pages=622–640|url=http://www.cecm.sfu.ca/personal/pborwein/PAPERS/P56.pdf|jstor=2324993|hdl=1959.13/1043650|hdl-access=free|access-date=2009-03-02|archive-date=2016-05-09|archive-url=https://web.archive.org/web/20160509033517/http://www.cecm.sfu.ca/personal/pborwein/PAPERS/P56.pdf|url-status=dead}}.
Extension to negative integers
The digit sum can be extended to the negative integers by use of a signed-digit representation to represent each integer.
Properties
The amount of n-digit numbers with digit sum q can be calculated using:
Applications
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 decimal 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 technique for checking calculations.
Digit sums are also a common ingredient in checksum algorithms to check the arithmetic operations of early computers.{{citation|doi=10.2307/2002859|title=The Logical Design of the Raytheon Computer|first1=R. M.|last1=Bloch|first2=R. V. D.|last2=Campbell|first3=M.|last3=Ellis|journal=Mathematical Tables and Other Aids to Computation|volume=3|issue=24|year=1948|pages=286–295|publisher=American Mathematical Society|jstor=2002859}}. Earlier, in an era of hand calculation, {{harvtxt|Edgeworth|1888}} suggested using sums of 50 digits taken from mathematical tables of logarithms 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.{{citation|first=F. Y. |last=Edgeworth |author-link=Francis Ysidro Edgeworth |title=The Mathematical Theory of Banking |journal=Journal of the Royal Statistical Society |volume=51 |issue=1 |year=1888 |pages=113–127 |url=http://instruct1.cit.cornell.edu/courses/econ719/Edgeworth.pdf |url-status=dead |archive-url=https://web.archive.org/web/20060913155630/http://instruct1.cit.cornell.edu/courses/econ719/Edgeworth.pdf |archive-date=2006-09-13 }}.
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 numbers are defined in terms of divisibility by their digit sums, and Smith numbers are defined by the equality of their digit sums with the digit sums of their prime factorizations.
See also
References
{{reflist}}
External links
- {{mathworld|urlname=DigitSum|title=Digit Sum}}
{{Classes of natural numbers}}