0

Consider set $S = \{2^0, 2^1, 2^2, 2^3, 2^4, 2^5, \dots, 2^{2003}, 2^{2004}\}$ and $\log2 = 0.3010$. Find the number of elements in the set $S$ whose most significant digit is 4.

It is also known that the most significant digit of $2^{2004}$ is 1 and consists of 604 digits.

I'm interested in an answer that solves it without the use of scientific calculators.

Someone solved it using the below method but it went over my head:

1 1 1 1 1

2 2 2 3 3

4 4 5 6 7

8 9

Above pattern is followed in powers of as 2^0 = 1, 2^1 = 2, 2^2 = 4, 2^3 = 8, 2^4 = 16, 2^5 = 32, 2^6 = 64, 2^7 = 128, 2^8 = 256, 2^9 = 512.

Let X be the number of groups that show the pattern of 4 and let Y be the number of groups that show the pattern of 3. Since MSD (most significant digit) of 2^2004 is 1 and contains 604 digits so 2^2003 will the largest number of the set with 603 digits.

Now, X + Y = 603 4X + 3Y = 2004 so X = 195

So, the answer is 195.

I know that the answer 195 is correct but how? The above solution provided to me contains a lot of technicality like how do we know that powers of 2 has MSD as 7 and 9 too and what is the deal with the X and Y thing that ultimately leads us to the answer?

  • You're going to need $\log 4$ and $\log 5$ as well. If that means you need a scientific calculator, then I don't think you can do this without one. – Arthur May 29 '22 at 12:45
  • @Arthur log 4 and log 5 can be calculated using log 2 itself (log 2 = 2log 4 and log 5 = log 10 - log 2) so please provide me with your approach on how to solve using these logs. – InanimateBeing May 29 '22 at 12:52
  • @Carefree Xplorer: Works for $12+10n$ up to $n=8$; but fails at $n=9$. – paw88789 May 29 '22 at 12:53
  • @CarefreeXplorer Try $n=49$. – Arthur May 29 '22 at 12:53
  • 1
    @Abhi You're right. Then consider this: How can you tell from the logarithm of a number that it has leading digit $4$? – Arthur May 29 '22 at 12:54
  • Also the logarithm given ($\log 2 = .3010$) is an approximation, and so results may break down after a while (as rounding errors build up). – paw88789 May 29 '22 at 12:57
  • @Arthur and everyone who tried, I'm sorry as I didn't include everything in my question earlier, but after Arthur's question I felt the need to do so, so thanks Arthur. Also, I have now editted my question. – InanimateBeing May 29 '22 at 13:22
  • I've answered your actual question about the solution given in your question. – Brian Tung May 29 '22 at 23:23

3 Answers3

2

We have $\log 4=2 \log 2 \approx 0.602$ and $\log 5 = \log 10 - \log 2 \approx 0.699$. From Benford's law we expect about $0.699-0.602=0.097$ of the numbers to start with $4$, so we need to compute $0.097 \cdot 2004 =(0.100-0.003)2004=200.4-6.0=194.4$ as a guess.

To tell if a number has leading digit $4$ you look at the decimal part of the base $10$ logarithm. If it is between $0.602$ and $0.699$ the leading digit will be $4$. The logs of the powers of $2^n$ will be reasonably evenly distributed because they are just $0.301n$

Ross Millikan
  • 374,822
1

The leading digits of powers of an integer greater than $1$ will follow Benford's law quite closely (especially in the long run).

According to Benford's law, for appropriate data sets, the proportion of items with leading digit $4$ should be (very close to) $\log \left(\frac{5}{4}\right)$ (base ten logarithm being used here).

You can get approximations for $\log (4)$ and $\log(5)$ from the given approximation for $\log(2)$. And from that you can get a good approximation for $\log \left(\frac{5}{4}\right)=\log(5)-\log(4)$.

This will lead you to a value that is very close to the actual answer (which I (cheatingly) checked with Python)...the error is less than $1$ (i.e., the value you get will round up or down to the exact answer).

Calculator not needed if you're willing to do the necessary arithmetic by hand.

paw88789
  • 40,402
  • Thanks a lot for your effort. I have editted my question a bit now, what you have mentioned in your solution can it now arrive at the answer? – InanimateBeing May 29 '22 at 13:26
  • Hey @paw88789 just read your explanation again and realized that you had mentioned exactly what Ross Millikan did but since latter had numbers so that made the picture a bit clearer to my dense head. Sorry, though system does not permits but you both deserve the tick from me :( Also, I wanted to ask you (as now I like your explanation better) whether the answer will be 92 had the question asked for 9 instead of 4? Lastly, can you share the Python code with me? – InanimateBeing May 29 '22 at 17:02
  • 1
    I didn't save the code. I wrote a function called leading_digit(n) that returned something like int(str(n)[0]). If you know Python you can probably take it from there. – paw88789 May 30 '22 at 00:37
  • Sure, will try it this time, thanks a ton for your guidance @paw88789 – InanimateBeing May 30 '22 at 03:25
1

To expand on how the solution you included in your question works: Consider the powers of $2$ with $k$ digits. There are five possible sequences of first digits of these $k$-digit powers of $2$:

  • $1 \to 2 \to 4 \to 8$. For instance, for $k = 1$ digit, we have $2^0 = \boldsymbol{1}$, $2^1 = \boldsymbol{2}$, $2^2 = \boldsymbol{4}$, and $2^3 = \boldsymbol{8}$.
  • $1 \to 2 \to 4 \to 9$. For instance, for $k = 16$ digits, we have $2^{50} = \boldsymbol{1}125899906842624$, $2^{51} = \boldsymbol{2}251799813685248$, $2^{52} = \boldsymbol{4}503599627370496,$ and $2^{53} = \boldsymbol{9}007199254740992$.
  • $1 \to 2 \to 5$. For instance, for $k = 3$ digits, we have $2^7 = \boldsymbol{1}28$, $2^8 = \boldsymbol{2}56$, and $2^9 = \boldsymbol{5}12$.
  • $1 \to 3 \to 6$. For instance, for $k = 2$ digits, we have $2^4 = \boldsymbol{1}6$, $2^5 = \boldsymbol{3}2$, and $2^6 = \boldsymbol{6}4$.
  • $1 \to 3 \to 7$. For instance, for $k = 14$ digits, we have $2^{44} = \boldsymbol{1}7592186044416$, $2^{45} = \boldsymbol{3}5184372088832$, and $2^{46} = \boldsymbol{7}0368744177664$.

For every number length ranging from $k = 1$ digit through $k = 603$ digits, we must see one of those five patterns. This covers all of $S$ except $2^{2004}$, which begins with a $1$.

Let $x$ be the number of patterns of length $4$ (the first two) and $y$ be the number of patterns of length $3$ (the last three). Then from the fact that there are $603$ different number lengths under consideration, we have

$$ x+y = 603 $$

From the fact that there are $2004$ powers of $2$ under consideration, and knowing that $x$ patterns are of length $4$ and $y$ patterns of length $3$, we have

$$ 4x+3y = 2004 $$

Solving these yields $x = 195$ and $y = 408$. Since the patterns of length $4$ are exactly those that contain a power of $2$ with the first digit $4$, the number of such powers of $2$ is $x = 195$.


The above solution does not use the value of the log (base $10$) of $2$. Here's one way to use it: First, imagine that the log of $2$ was exactly $0.3$. Then the log of $2^2 = 4$ would be $0.6$, that of $2^3 = 8$ would be $0.9$, and so forth. The log of $10/2 = 5$ would be $1-0.3 = 0.7$. So a power of $2$ would begin with $4$ if its log had a decimal portion of $0.6$.

Since $3$ and $10$ are relatively prime, the log of every $10$ consecutive powers of $2$ would contain each of the decimal portions from $0.0$ through $0.9$ exactly once each, meaning that they would contain $0.6$ exactly once, meaning in turn that exactly one of those $10$ powers of $2$ would begin with $4$. These would be $2^2, 2^{12}, 2^{22}, \ldots, 2^{2002}, \ldots$ and the answer to our question would be $201$.

But the log of $2$ is not exactly $0.3$. A closer approximation is $0.301$. Suppose that were exact; then the log of $4$ would be $0.602$, and that of $5$ would be $1-0.301 = 0.699$. Since $301$ and $1000$ are relatively prime, the logs of every $1000$ consecutive powers of $2$ would contain each decimal portion from $0.000$ through $0.999$ exactly once each, meaning in particular that it would contain a decimal portion between $0.602$ and $0.698$ (inclusive) exactly once each, meaning in turn that there would be $698-602+1 = 97$ powers of $2$ that began with $4$. Along with $2^{2002}$, the answer to our question would be $97+97+1 = 195$.

That turns out to be the answer, but to be sure, we'd have to know the log of $2$ to more digits. Five digits is a good place to stop; the log of $2$ to five digits is $0.30103$, and that is very accurate. (The value to ten digits is $0.3010299957$.) With that value, and a bit more algebra, we can confirm the answer of $195$.

Brian Tung
  • 34,160
  • Thank you @Brian Tung and just one more doubt, can a non-professional like myself know by some way or maybe intuitively that greater/latter powers of 2 will contain 9 or 7 as MSD and secondly, is it necessary to know them as even if I am aware of only this much that a pattern of length 4 is followed by that of length 3 then by the solution you have mentioned I would still arrive at the correct answer? – InanimateBeing May 30 '22 at 03:24
  • 1
    @InanimateBeing: Note that the solution doesn't actually depend on any power of $2$ actually beginning with either $7$ or $9$. That being said, there is a sense in which the first digits of the powers of $2$ are "randomly distributed" and we expect that therefore $7$ or $9$ will get their "fair share" of powers of $2$. This intuition can be made more tangible with reasoning along the lines of Benford's Law, which others mentioned. As to how one can acquire that sense, I can only suggest that it's a matter of experience. – Brian Tung May 30 '22 at 07:38
  • 1
    @InanimateBeing: Similarly, the intuition which leads one to the solution you quoted is also a matter of experience. I don't think it's a matter of professional vs non-professional; in fact, this question has a "contest" feel which is rather more the purview of recreational mathematics, although I would certainly expect most mathematicians of any ilk to come up with a Benford's Law line of reasoning almost immediately. – Brian Tung May 30 '22 at 07:40
  • Alright, got you. Thanks a lot @Brian Tung and you are right about the "contest" thing. This question is asked from the view point of common entrance exams to check the quantitative aptitude. I'm filled with reverence for you. – InanimateBeing May 30 '22 at 16:10