Distribution of Nonzero Digits in a Greedy Sequence of Powers of Two
David Wu

TL;DR
This paper investigates the digit distribution in a specially constructed sequence of powers of two, revealing how trailing digits can be preserved and zeroes maximized between nonzero digits using elementary methods.
Contribution
It introduces a method to construct powers of two that preserve trailing digits and maximize zeroes between nonzero digits, providing new insights into digit distribution patterns.
Findings
Sequence can preserve trailing digits
Maximizes zeroes between nonzero digits
Provides heuristic for trailing digit patterns
Abstract
Understanding the distribution of digits in the expansions of perfect powers in different bases is difficult. Rather than consider the asymptotic digit distributions, we consider the base-10 digits of a restricted sequence of powers of two. We apply elementary methods to show that this sequence of powers of two can be constructed to preserve trailing digits while locally maximizing the number of zeroes between nonzero digits. We also provide a heuristic description of the trailing digits of these powers of two.
| Gap Size | Frequency | Weighted Sum |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 0 | 0 |
| 2 | 98 | 196 |
| 3 | 81 | 243 |
| 4 | 34 | 136 |
| 5 | 18 | 90 |
| 6 | 11 | 66 |
| 7 | 5 | 35 |
| 8 | 2 | 16 |
| 9 | 1 | 9 |
| 10 | 1 | 10 |
| 11 | 0 | 0 |
| 12 | 1 | 12 |
| Average | 3.226190476 |
| Gap Size | Frequency | Weighted Sum |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 0 | 0 |
| 2 | 293 | 586 |
| 3 | 235 | 705 |
| 4 | 112 | 448 |
| 5 | 62 | 310 |
| 6 | 26 | 156 |
| 7 | 21 | 147 |
| 8 | 7 | 56 |
| 9 | 1 | 9 |
| 10 | 1 | 10 |
| 11 | 1 | 11 |
| 12 | 1 | 12 |
| Average | 3.223684211 |
| Digit | 1 | 3 | 5 | 7 | 9 | Total |
|---|---|---|---|---|---|---|
| Frequency | 55 | 128 | 139 | 124 | 67 | 513 |
| 0.107 | 0.250 | 0.271 | 0.242 | 0.131 | ||
| Digit | 1 | 3 | 5 | 7 | 9 | Total |
| Frequency | 113 | 260 | 272 | 244 | 124 | 1013 |
| 0.112 | 0.257 | 0.269 | 0.241 | 0.122 |
| Number of zeros | |||||||||||
| Digit | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 1 | 0 | 46 | 35 | 19 | 8 | 2 | 1 | 2 | 0 | 0 | 0 |
| 3 | 140 | 72 | 23 | 9 | 6 | 2 | 3 | 0 | 1 | 2 | 1 |
| 5 | 133 | 66 | 24 | 23 | 11 | 11 | 3 | 0 | 0 | 0 | 1 |
| 7 | 129 | 54 | 27 | 18 | 5 | 8 | 1 | 2 | 0 | 0 | 0 |
| 9 | 0 | 56 | 36 | 17 | 11 | 3 | 1 | 0 | 0 | 0 | 0 |
| Probabilities | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Digit | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 1 | 0.000 | 0.407 | 0.310 | 0.168 | 0.071 | 0.018 | 0.009 | 0.018 | 0.000 | 0.000 | 0.000 |
| 3 | 0.541 | 0.278 | 0.089 | 0.035 | 0.023 | 0.008 | 0.012 | 0.000 | 0.004 | 0.008 | 0.004 |
| 5 | 0.489 | 0.243 | 0.088 | 0.085 | 0.040 | 0.040 | 0.011 | 0.000 | 0.000 | 0.000 | 0.004 |
| 7 | 0.529 | 0.221 | 0.111 | 0.074 | 0.020 | 0.033 | 0.004 | 0.008 | 0.000 | 0.000 | 0.000 |
| 9 | 0.000 | 0.452 | 0.290 | 0.137 | 0.089 | 0.024 | 0.008 | 0.000 | 0.000 | 0.000 | 0.000 |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
Topicssemigroups and automata theory · Computability, Logic, AI Algorithms · Benford’s Law and Fraud Detection
Distribution of Nonzero Digits in a Greedy Sequence of Powers of Two
David Wu
Abstract
Understanding the distribution of digits in the expansions of perfect powers in different bases is difficult. Rather than consider the asymptotic digit distributions, we consider the base-10 digits of a restricted sequence of powers of two. We apply elementary methods to show that this sequence of powers of two can be constructed to preserve trailing digits while locally maximizing the number of zeros between nonzero digits. We also provide a heuristic description of the trailing digits of these powers of two.
1 Introduction
Let’s consider the distribution of the base-10 digits of powers of two. A natural heuristic argues that the fraction of nonzero digits should be . Previous results proved bounds on the density of nonzero digits, such as Stewart’s lower bound of nonzero digits [1] or Radcliffe’s elementary lower bound of nonzero digits [2]. Instead of proving a lower bound over all powers of two, we consider the problem of locally maximizing the sparsity of nonzero digits in a 10-adic sequence of powers of . We use a very greedy algorithm that has surprising properties, and is well-suited to analyzing 10-adic powers of .
Recall that every power of two (and every natural number) can be uniquely represented in the form
[TABLE]
where and . In other words, this representation singles out the exponents that correspond to nonzero digits in the base-10 expansion of . Our goal is construct a sequence of exponents of such that the the sequence is locally sparse. That is, we try to locally maximize , the gaps between adjacent nonzero digits. We explain the algorithm formally and provide a running example.
We proceed as follows. Suppose we have constructed satisfying
[TABLE]
where and .
Then, for each , repeat this process to find . If some value of yields a value of that is smaller than the value of by some other , discard the smaller and its descendants , etc.
Consider all powers with
[TABLE]
for and retain only those exponents that give the largest value of . We denote each of these values of as . For example, let so . In our example, we look at and find that gives . We can show that this is the largest possible . Hence, we can take to be the residue class .
In our example, let’s take . Then
[TABLE]
Then we look for such that (here, we can see that is maximal). We find that if , then . However, if then , and it can be shown that this is the maximum possible . Therefore, we take to be the residue class and discard all other residue classes such as .
We illustrate the next two iterations. Taking , we find
[TABLE]
Then we search for and find . This gives
[TABLE]
Hence we only preserve the residue class . The process continues thereafter.
This yields a sequence of exponents of and corresponding exponents of . In other words, we are using a greedy strategy to construct a -adic power of whose infinite -adic expansion has many zeros.
In other words, when constructing , we preserve and for . Suppose we have constructed satisfying
[TABLE]
where all and . We only consider powers with
[TABLE]
With this restriction, we show in Section 2 that there are very few possible values of . More specifically, suppose we have constructed . Then if , the only valid exponents are for . Pseudocode for the algorithm can be found in the Appendix.
Our strategy does not necessarily give powers of with the highest density of zeros. For example, has only zeros among its 32 digit, while has seven zeros among its digits. However, we obtain many zeros in the early terms of the expansion.
In Section 2, we show that we always have , so we can always obtain at least consecutive zeros after each nonzero digit. Moreover, we show that our constraints create a unique sequence of . We also investigate various other phenomena with digit distributions that occur. In Section 3, we provide a heuristic that predicts that the density as . This agrees well with the data we computed in Tables 1 and 2.
2 Properties of the greedy sequence
We first state and prove a lemma.
Lemma 1**.**
Let . Then if and only if .
Proof.
Since is a primitive root mod , we have if and only if . Now since , we have . The result follows from Chinese Remainder Theorem. ∎
Lemma 2**.**
Let . Suppose . Write
[TABLE]
with . As runs through the integers , the values of run through all the integers in either or .
Proof.
Since , we know that . Since divides , we can divide through by , which shows that Therefore the parity of is determined by . Lemma 1 says that distinct values of give distinct values of . The lemma follows easily. ∎
For choose integers and write
[TABLE]
where for each and where . Assume that the are chosen by the “greedy strategy”. That is, are chosen so that and is as large as possible.
Theorem 1**.**
If the are chosen by the greedy strategy, then the are odd for .
Proof.
In Lemma 2, let , let , and let . Write
[TABLE]
For some , we have . Lemma 1 shows that as runs through the integers , will run through the integers between [math] and that have the same parity as . Therefore, if is even, we can pick such that . This means that is not maximal, so must be odd, as desired. ∎
Theorem 2**.**
Let
[TABLE]
where is chosen by the greedy strategy described in the introduction. Then .
Proof.
Suppose . Then
[TABLE]
with for . Theorem 1 says that and must be odd. When ,
[TABLE]
Since divides
[TABLE]
and (this is why we used instead of ), we can divide by to obtain
[TABLE]
for some integer . Since and are odd, we find that . This allows at most three values of . But Lemma 2 says that runs through all values congruent to , and we have omitted only from consideration, so there are remaining distinct values of . This contradiction implies that . ∎
We now illustrate an example of Lemma 2.
Example 2.1**.**
We can compute . Here the third nonzero digit is , which is even. As Lemma 2 claims, we can construct the modified exponent such that . The effect of adding to the exponent is that the nonzero even digit corresponding to was changed to a [math]. Furthermore, note that aside from the units digit, all of the nonzero digits in are odd.
Now suppose that we have greedily constructed . Recall that
[TABLE]
We claim that there is a unique choice of that corresponds with .
Definition**.**
For , We say that is -forceable if there exists such that . In other words, we can find such that has at least zeros between and . Equivalently, we require that . On the other hand, we say that is –unforceable if there does not exist such that .
Example 2.2**.**
We consider , with and . So and . Consider the values of :
[TABLE]
Therefore, by looking at the parity of for each possible , we see that , , and are [math]-forceable (equivalently, they are -unforceable). Therefore, we only need to consider and .
Next, we calculate and for and find
[TABLE]
Note that there is a unique choice of that forces a zero after . Therefore, we see that is -forceable, while is -forceable.
Corollary 1**.**
Consider the sequence , , , , . Suppose is -forceable. If then it is the unique -forceable . The same result holds if . That is, there is no alternate sequence , , , , such that and is -forceable.
Proof.
Suppose that is -forceable and ; the proof for is analogous. By definition, we can construct such that , where is a digit integer. We split the proof into two cases.
Case 1: We replace with , , or .
This case is simple; working modulo as in the proof of Theorem 2, we must have . So cannot be , , or .
Case 2: We replace with .
If we replace with , we can force at least one more zero by using the modulo argument as in the proof of Theorem 2. Now we have
[TABLE]
where and for some . Now we have and . Therefore, we can divide out by ; we arrive at . Thus must be odd, which implies that is -unforceable, as desired. ∎
Corollary 2**.**
Suppose that is -forceable. If , then it is the unique -forceable .
Proof.
The proof is entirely analogous to the proof of Corollary 1. ∎
The same property does not hold if either or happen to be -forceable because their difference is a multiple of . However, the following two properties do hold.
Corollary 3**.**
* is -forceable if and only if is -forceable.*
Proof.
Suppose that , , , has been constructed such that . Then the modified sequence , , , has .
Applying the modulo argument as in Theorem 2, we find that if is -forceable, then is also -forceable. The reverse implication also follows. Now assume that is -forceable. So we have
[TABLE]
for and for .
Subtracting and dividing by , we obtain . Therefore, . By hypothesis, is -forceable, so is even. Therefore is also even, which means that is also -forceable, as desired. ∎
Corollary 4**.**
Suppose that is -forceable. If , then it is the unique -forceable . The same result holds if . That is, exactly one of and is -forceable; the other is -unforceable.
Proof.
Suppose that or is -forceable. Then by Corollary 3, there exist and such that
[TABLE]
where again and for .
Subtracting and dividing out by , we have . So and must have different parities. If is -forceable, then is even, so is odd. Therefore is -unforceable, as desired. The same logic holds if is -forceable. The claim is thus proved. ∎
3 Heuristic argument for the expected sparsity of nonzero digits
We justify a heuristic that predicts the expected number of zeros between nonzero digits in our sequence.
Heuristic 1** (Expected Gap of zeros).**
Let be the expected value of . Then
[TABLE]
Proof.
Empirical evidence (refer to Table 3) suggests that the probability that a nonzero digit is 1 or 9 is approximately . We can also think of and being their own group of digits, with and being the other three groups of digits. According to Corollaries 1 and 2, if the nonzero digit is or , there is only one choice of starting digit that is -forceable. We have already seen that if the leading digit is or , we can force two zeros with a greedy algorithm, and if the leading digit is or , we can force three zeros with a greedy algorithm. Then is equal to
[TABLE]
For convenience, let and . If we assume that the parity of each digit thereafter is uniformly random, then the probability that we obtain exactly zeros after the two forced zeros is . Hence,
[TABLE]
From elementary calculus, we have
[TABLE]
Therefore, evaluates as
[TABLE]
We now turn to evaluating . Intuitively, Corollary 4 tells us that should be larger than . More precisely, Corollary 4 shows that we have three guaranteed zeros. Assuming that every zero thereafter is uniformly random, we have
[TABLE]
Thus, , as desired. ∎
The estimation of is remarkably close to the empirical average of gathered for (see Tables 1 and 2).
4 Acknowledgments
The author would like to thank Lawrence C. Washington for suggesting the problem and for his helpful guidance throughout the process.
Appendix A Data
Appendix B Code
We define our algorithm as follows, where .
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] C. L. Stewart, “On the representation of an integer in two different bases,” J. reine angew. Math. , vol. 319, pp. 63–72, 1980.
- 2[2] D. G. Radcliffe, “The growth of digital sums of powers of 2,” ar Xiv.org , 2016.
