What's the first power of two for which the most significant digit is 7?

I was just reading an anecdote about a third-grade student who was asked by her math teacher to find a number which, when two is raised to the power of that number, produces a number that starts with the digit 7 (in base 10, as the context makes clear).

I was able to quickly write a one-liner in Perl that found the smallest such number, 46, which is also the number ultimately found by the student. But the story states that the question was given in a math class, and implies that the student found the answer without the aid of a computer.

I haven't been able to come up with an avenue of attack for this problem that doesn't depend on a computer, much less one that a third-grader, even at a relatively advanced level of mathematics, might discover. So how can this be done?

In the more general case, it would be nice to see a solution to the problem of "Given an integer $b$ and digit $d$, what's (a/the smallest) power $n$ such that $b^n$ has leading digit $d$ in base 10?"

• It's not impossible the student just calculated powers of 2 by hand until they got there. It only takes ten or twenty minutes. – Chris Eagle Sep 20 '11 at 23:51
• Often Grade $3$ kids do not know very much, but some of them are very sharp. It is only a few years later that the long slide downhill begins. – André Nicolas Sep 21 '11 at 0:37
• @Chris 46 iterations in 10 or 20 minutes? I doubt that most third graders won't be that fast, even if it is just doubling the integer each time. Of course, we are talking about some one kid who managed to solve it; perhaps she was fast... – Srivatsan Sep 21 '11 at 5:04
• ? Was it really an anecdote? Either I didn't take it or have different sense of humour :-) – Tomas Sep 21 '11 at 10:34
• @Srivatsan Well, that's how long I took, and I'm pretty sure I was better at arithmetic when I was nine. – Chris Eagle Sep 21 '11 at 10:52

It is not all that hard, if we remember the frequently useful $2^{10}=1024$, which is $2.4$ percent more than $1000$.

The small power of $2$ that is closest to beginning with $7$ is $2^6$, which is $64$. We need to increase $64$ by a bit under $10$ percent, times a power of $10$. But since we are concerned only about the first digit, we don't really even see the powers of $10$, intuitively we just want to push from $6.4$ to $7$.

It is easy to see that pushing up twice by $2.4$ percent is not enough to push us up to beginning with $7$. That doing it three times is not enough is less obvious, but a bit of fooling around, even without a calculator, does the job: although the compounding helps, $2.4$ percent three times does not give $10$ percent. It is clear that increasing $64$ by $2.4$ percent four times will get us to the $7$, and leaves us quite far from beginning with $8$. So the required power is $6+(10)(4)$.

The starting digit that takes longest to reach is $9$. This is trickier to do by hand, for $2^{53}$ barely gets us there. It is the first legitimate candidate, but calculations have to be more accurate than for the digit $7$, to make sure that we don't need to go up to $63$.

I don't want to dismiss the possibility that some third-grader understands enough about exponents to solve this, but I think it's more likely that the question was presented differently than the way it's described. Third grade is usually when students learn multiplication, and this exercise is really just about multiplying by 2:

Exercise: Multiply 2 x 2. Then multiply the answer again by 2. How many times do you have to multiply by 2 until the first digit of the answer is 7?

It's an interesting way to practice multiplication by 2 on a series of problems, and I don't think 46 iterations would take unreasonably long to do by hand. Except for the fact that the numbers get longer as you go along, it's not more than 2 pages of homework.

Granted, not all third-graders would have the patience, but I'm sure some kids would love to grind away on a repetitive problem like this because it's big (the final number is 14 digits long!), but it's still within their ability.

• This reminds me of the tale of Gauss' first grade teacher assigning to the class to sum the digits 1 through 100 as busy work. Obviously, Gauss did this instantly in his head (5050 as its fifty pairs of 101). I agree the teacher expected the student to brute force it, not to analyze the problem. – dr jimbob Sep 21 '11 at 8:30
• A nice thought, but in the story the student asked her father for help, who called upon a mathematician friend of his to give her advice on how to proceed. It didn't sound as if the problem were simply to follow a recipe. – Sean Sep 21 '11 at 18:51

In base $10$ logarithms, a leading digit of $7$ is the same as a fractional part of the logarithm between $\log_{10}(7)=0.845098040014257$ and $\log_{10}(8)=0.903089986991943$. $46\;\log_{10}(2)=13.8473798005431$ is the first multiple of $\log_{10}(2)=0.301029995663981$ that has the proper fractional part. Thus, $2^{46}=70368744177664$ is the first power of two whose most significant digit is $7$.

However, as for a method to be executed without a calculator, this doesn't seem to be it. If you knew $\log_{10}(2)$ and $\log_{10}(7)$, you could do this by repeated addition since $\log_{10}(8)=3\;\log_{10}(2)$.

• I'm just curious: Did you find this number $46$ by checking all multiples of $\log(2)$ and checking whether their fractional part is between the two numbers? Or is there some more efficient method to find this number? – TMM Sep 20 '11 at 23:49
• @Thijs: I just added $\log_{10}(2)$ until the fractional part was within the proper range. I don't see any quicker method, but I would be interested to see one, if it should be possible. – robjohn Sep 21 '11 at 0:46
• But how do you propose to compute the logarithms by hand? – Bill Dubuque Sep 21 '11 at 1:31
• @Bill: As I said in my answer: "as for a method to be executed without a calculator, this doesn't seem to be it". – robjohn Sep 21 '11 at 2:35
• @rob Ah, yes, I missed that on first glance. – Bill Dubuque Sep 21 '11 at 2:45

HINT $\rm\ \ 2^{k+10\:n} =\ 2^{\:k}\ 1024^n\:$ has leading digits $\rm\: \approx\ d\ (1 + 0.024\ n)\$ where $\rm\:d\:$ ranges over the leading digits of the powers of $\rm\:2\:$ below $2^{10},\:$ all of which are far from $7$ except for $2^6 = 64\:.$ Thus for $\rm\:d = 64$ we desire $\rm\ 70 \le 64\ (1 + 0.024\ n) < 80\:,\:$ so $\rm\: 6 \le 1.5\ n < 16\:,\:$ so $\rm\: 4\le n < 10\:.$

Thus we deduce that $\rm\:n = 4\:$ is least, indeed $\rm\:2^{46} = 70368744177664\:.\:$ The other values of $\rm\:n\:$ also work, though the exclusion of $\rm\:n=10\:$ is by luck because the approximations aren't strong enough.