TOPICS
Search

Digit Sum


A digit sum s_b(n) is a sum of the base-b digits of n. The base-10 digit sum of the integer n is implemented in the Wolfram Language as DigitSum[n], and the base-b digit sum as DigitSum[n, b].

The following table gives s_b(n) for n=1, 2, ... and small b.

bOEISs_b(n) for n=1, 2, ...
2A0001201, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, ...
3A0537351, 2, 1, 2, 3, 2, 3, 4, 1, 2, 3, 2, 3, 4, 3, ...
4A0537371, 2, 3, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, ...
5A0538241, 2, 3, 4, 1, 2, 3, 4, 5, 2, 3, 4, 5, 6, 3, ...
6A0538271, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 2, 3, 4, 5, ...
7A0538281, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 2, 3, ...
8A0538291, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, ...
9A0538301, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, ...
10A0079531, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, ...
DigitSums

Plots of the digit sums of first thousand positive integers are illustrated above for bases 2 to 10.

DigitSum

Plotting s_b(n) versus b and n gives the plot shown above.

The digits sum s_b(n) satisfies the congruence

 n=s_b(n) (mod b-1).
(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.

s_b(n) satisfies the following unexpected identity

 sum_(n=1)^infty(s_b(n))/(n(n+1))=b/(b-1)lnb,
(2)

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

sum_(n=1)^(infty)s_2(n)(2n+1)/(n^2(n+1)^2)=(pi^2)/9
(3)
sum_(n=2)^(infty)[s_2(n)]^2(8n^3+4n^2+n-1)/(4n(n^2-1)(4n^2-1))=(17)/(24)+ln2
(4)

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

Let u(n) be the number of digit blocks of 11 in the binary expansion of n, then

sum_(n=1)^(infty)(u(n))/(n(n+1))=3/2ln2-1/4pi
(5)

(OEIS A100046; Allouche 1992).

Sondow (2006) noted the unexpected identity

 product_(n=0)^inftyproduct_(k=1,3,...)^(b-1)((nb+k)/(nb+k+1))^((-1)^(s_b(n)))=1/(sqrt(b)).
(6)

The special case of b=2 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 1+7+2+9=19, and 19×91=1729. These are the only four numbers with this property, as proved by Fujiwara (Fujiwara and Ogawa 2005).


See also

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

Explore with Wolfram|Alpha

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/.

Referenced on Wolfram|Alpha

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

Subject classifications