TOPICS

# Digit Sum

A digit sum is a sum of the base- digits of , which can be implemented in the Wolfram Language as

`  DigitSum[n_, b_:10] := Total[IntegerDigits[n, b]]`

The following table gives for , 2, ... and small .

 OEIS for , 2, ... 2 A000120 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, ... 3 A053735 1, 2, 1, 2, 3, 2, 3, 4, 1, 2, 3, 2, 3, 4, 3, ... 4 A053737 1, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, ... 5 A053824 1, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, ... 6 A053827 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, ... 7 A053828 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 2, 3, ... 8 A053829 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, ... 9 A053830 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, ... 10 A007953 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, ...

Plotting versus and gives the plot shown above.

The digits sum satisfies the congruence

 (1)

In base 10, this congruence is the basis of casting out nines and of fast divisibility tests such as those for 3 and 9.

satisfies the following unexpected identity

 (2)

the case of which was given in the 1981 Putnam competition (Allouche 1992). In addition,

 (3) (4)

(OEIS A100044 and A100045; Allouche 1992, Allouche and Shallit 1992).

Let be the number of digit blocks of 11 in the binary expansion of , then

 (5)

(OEIS A100046; Allouche 1992).

Sondow (2006) noted the unexpected identity

 (6)

The special case of corresponds to a Thue-Morse sequence product (J. Sondow, pers. comm., Oct. 31, 2006).

The numbers 1, 81, 1458 and 1729 (OEIS A110921) are each the product of their own digit sum and its reversal, for example , and . These are the only four numbers with this property, as proved by Fujiwara (Fujiwara and Ogawa 2005).

Casting Out Nines, Digital Root, Digit, Digit Block, Digit Count, Digit Product, Divisibility Tests

## Related Wolfram sites

http://functions.wolfram.com/NumberTheoryFunctions/DigitCount/

Portions of this entry contributed by Topher Cooper

## References

Allouche, J.-P. "Series and Infinite Products Related to Binary Expansions of Integers." 1992. http://algo.inria.fr/seminars/sem92-93/allouche.ps.Allouche, J.-P. and Shallit, J. "The Ring of k-Regular Sequences." Theor. Comput. Sci. 98, 163-197, 1992.Fujiwara, M. and Ogawa, Y. Introduction to Truly Beautiful Mathematics. Tokyo: Chikuma Shobo, 2005.Grabner, P. J.; Herendi, T.; and Tichy, R. F. "Fractal Digital Sums and Codes." Appl. Algebra Engrg. Comm. Comput. 8, 33-39, 1997.Shallit, J. O. "On Infinite Products Associated with Sums of Digits." J. Number Th. 21, 128-134, 1985.Sloane, N. J. A. Sequences A000120/M0105, A007953, A053735, A053737, A053824, A053827, A053828, A053829, A053830, A100044, A100045, and A100046 in "The On-Line Encyclopedia of Integer Sequences."Sondow, J. "Problem 11222." Amer. Math. Monthly 113, 459, 2006.Trott, M. The Mathematica GuideBook for Programming. New York: Springer-Verlag, p. 218, 2004. http://www.mathematicaguidebooks.org/.

Digit Sum

## Cite this as:

Cooper, Topher and Weisstein, Eric W. "Digit Sum." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/DigitSum.html