MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Results about numbers that are related to their decimal representation are usually confined to recreational mathematics. There I have seen mainly questions about individual numbers, like finding a number that is the sum of the cubes of its digits. But I have not yet seen a systematic study of such questions.

A result that prompted me to asked this question was the following from Kurt Hensel's "Zahlentheorie". There he shows that the exponent of highest power of a prime $p$ that divides the number $n$ is $$\frac{s_{n-1} - s_n + 1}{p - 1},$$ where $s_n$ is the sum of the digits in the representation of $n$ with base $p$. From this he derives that the highest power of $p$ that divides $n!$ is $$\mu_n = \frac{n - s_n}{p - 1}.$$ This is a different and much simpler formula than the representation $\mu_n = \sum_{k = 0}^\infty \left\lfloor \frac{n}{p^k} \right\rfloor$ by Legendre, which I usually see in the literature.

I would like to know whether there are more results of this type. To be more precise, I define the not-yet-existing field of "Digit Theory" as the study of number-theoretic questions with help of the positional representation of numbers, and the study of the positional representation itself.

So are there already systematic treatments of "Digit Theory" or of parts of it? Are there other interesting results like that one above?

share|cite|improve this question
To say that ${\rm ord}_p(n) = (s_{n-1}-s_n+1)/(p-1)$ for all $n \geq 1$ or that ${\rm ord}_p(n!) = (n - s_n)/(p-1)$ for all $n \geq 1$ are equivalent, on account of ${\rm ord}_p(n) = {\rm ord}_p(n!) - {\rm ord}_p((n-1)!)$. Personally I find it more natural to take the formula for ${\rm ord}_p(n!)$ as a starting point and then read off ${\rm ord}_p(n)$ from that than the other way around. I've seen the formula for ${\rm ord}_p(n!)$ in terms of a sum of base $p$ digits in various books on $p$-adics, because it's actually useful, but the formula for ${\rm ord}_p(n)$ via base $p$ digits is not. – KConrad Mar 21 '13 at 23:25
This of course requires a simple direct proof for the formula for $\mathrm{ord}_p(n!)$. Do you know one? – rem Mar 22 '13 at 9:57
It follows directly from Legendre's formula by writing $n$ in base $p$ and computing $[n/p^k]$ in terms of that base expansion. That's the usual proof of the formula for ${\rm ord}_p(n!)$. – KConrad Mar 22 '13 at 13:09
I deleted my answer, among others, due the continued dismissive tone of you (op).If ever you have some serious interest in the matter I recommend you the book 'Automatic sequences: theory, applications, generalizations' (Cambridge University Press, 2003) [in particular its chapter on numeration systems, with various results on digits and many references on the subject; mainly on things not mentioned so far or anymore, and also mainly for integers]. – user9072 Mar 27 '13 at 21:36
  1. Lucas proved a congruence for binomial coefficients mod a prime $p$ that uses the base $p$ digits of the two numbers in the binomial coefficient. See It was extended to multinomial coefficients by Dickson.

  2. Stickelberger's congruence for Gauss sums (not to be confused with Stickelberger's congruence for the discriminant of a polynomial or number field) involves products of factorials of base $p$ digits. It is discussed in Section 11.3 of Lemmermeyer's "Reciprocity Laws from Euler to Eisenstein" and in chapter 1 of Lang's book on cyclotomic fields. The congruence lifts $p$-adically to the Gross--Koblitz formula for Gauss sums.

  3. Addition of numbers, expressed in terms of base expansions, is an elementary school example of cohomology. More precisely, the carry-digit function is a cocycle. See

  4. Dirichlet's theorem about primes in arithmetic progression could be interpreted in terms of digits in special cases, e.g., 1/4 of all primes have last decimal digit 1, 3, 7, or 9 (Dirichlet for modulus 10), or there is an equal proportion of primes having any string of two digits $ab$ not divisible by 2 or 5 as its last two digits (Dirichlet's theorem for modulus 100). In the other direction, with leading digits, the situation is less satisfactory: the set of primes with leading decimal digit 1 does not have a natural density within the set of all primes.

You should be cautious about pursuing "digit theory" within number theory too far, since it doesn't have a good reputation, the results of Lucas, Dickson, and Stickelberger notwithstanding. For instance, there is a review on MathSciNet about a paper involving digits that ends with the following remark: "There is also a list of serious number theory papers, by Lucas, Kummer, and others, that mention digits (usually to a prime base). But the reviewer is not convinced thereby that Smith numbers are not a rathole down which valuable mathematical effort is being poured." Smith numbers, Keith numbers, and emirps (that is not a typo) are all part of number theory in a broad sense, but not in a mainstream professional sense. Appearances can sometimes be deceiving: automorphic numbers may at first look totally recreational, but they are connected with the Chinese remainder theorem, Hensel's lemma, and the contraction mapping theorem. In a different direction, the statistical properties of digits in a fixed base for irrational numbers or continued fraction entries for irrational numbers have profound connections to ergodic theory, and if tomorrow someone proved $\pi$ is a normal number or that the continued fraction entries of $\sqrt[3]{2}$ are unbounded (Lang and Trotter did some computer calculations on that -- see an appendix to a recent edition of Lang's "Introduction to Diophantine Approximations") it would be an amazing development, probably as much as if someone showed the fractional parts of $(3/2)^n$ for $n = 1,2,3,...$ are equidistributed in $[0,1]$. It's not clear from the question if you considered "digit theory" to include such aspects of positional representations that are not directly about positive integer digits.

share|cite|improve this answer
There is some debate on the last paragraph on meta: – Martin Mar 26 '13 at 17:38

Benford's Law is quite a famous example, I guess. Although at first this was just an 'empirical law', there are actually good mathematical reasons for its existence. And, for example, the Fibonacci sequence, or the powers of two, also obey it.

share|cite|improve this answer

Persi Diaconis gave a talk about probabilities of carries at MIT about half a year ago. Unfortunately I was so busy trying to spot symmetric functions in the talk that most of it drifted past my mind, but here are a couple references:

Persi Diaconis and Jason Fulman, Carries, Shuffling and An Amazing Matrix, arXiv:0806.3583

Noga Alon, Minimizing the number of carries in addition, arXiv:1209.1131

This all seems to be more about the idea of elementary school addition rather than actual digits of numbers, but the OP seems to not be excluding this.

share|cite|improve this answer
Personal memo: carries is "retenues", not caries, which is "cavities". – Joël Mar 25 '13 at 3:13

I "discovered" this theory 40 years ago (I was 16 years old). In particular, I found the formula that you attribute to Kurt Hensel in a paper by Bunjakovskiĭ published in 188... (this might be the paper "Notes about one formula related to number theory", I found it in the library of my University in Russia, it was actually the final report for a grant he received from the government of Russia, so at least the Czar cared about "digit theory"). The only outcome of my study of the "digit theory" was a problem in the Monthly and a related question in MO.

share|cite|improve this answer
Thanks for bringing Bunjakovskiĭ to our attention. Do you refer to the first or the second formula? It seems that "digit theory" has existed for a long time in the mathematical underground, without ever becoming really respectable. – rem Mar 25 '13 at 9:45
In Ozhigova's "Development of Number Theory in Russia" (2nd ed., 2003), on page 92 she writes that Bunyakovskii's paper is from 1887, with the title Mark uses, and the formula she highlights is $(n-s_p(n))/(p-1) = \sum_{k \geq 1} [n/p^k]$, although there are some missing symbols; I give the best interpretation of what I find. It is closer to the second formula in the question than the first, but really it bypasses the interpretation as ${\rm ord}_p(n!)$ entirely. The original article would give a better sense of the context. Ozhigova says B. used the formula to solve problems, but no details. – KConrad Mar 25 '13 at 18:37
Here is the formula from the Bunyakovskii paper that Ozhigova writes: $(A−S(A)_p)/(p−1)=E(A/p)$, where $A$ is a positive integer and $S(A)_p$ is the sum of its base $p$ digits. The $E$ is old-fashioned notation for the greatest integer (Entière), and she wrote that the paper is concerned with sums $\sum Ef(x)$. So I presume $E(A/p)$ on the right was supposed to be $\sum E(A/p^k)$. – KConrad Mar 25 '13 at 18:42
The fact about factorials was well known at that time. I do not remember that paper (I read it 40 years ago) but it did contain many misprints. Bunjakovskiĭ was about 83-84 years old at that time and not in good health, he died in a year, 1889. – Mark Sapir Mar 25 '13 at 19:08

I don't know if the following qualifies as an "interesting result" in "digit theory", but Carlo Sanna, a student from the Università di Torino, has recently published a paper in elementary number theory [1] which is concerned with properties relating arithmetic progressions and the sum-of-digit function (in an arbitrary base $b$): It includes a few references and a number of questions that you may find at least intruiging.

[1] Carlo Sanna, On Arithmetic Progressions of Integers with a Distinct Sum of Digits, Vol. 15 (2012), Article 12.8.1 (see here).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.