# Solution to puzzle 122: Powers of 2 and 5

If the numbers 2n and 5n (where n is a positive integer) start with the same digit, what is this digit?  The numbers are written in decimal notation, with no leading zeroes.

The key insight is to note that 2n × 5n = 10n.  From here, it is clear that if 2n and 5n begin with the same digit, that digit must be either 1 (if 2n and 5n are both powers of 10), or 3.  Since n > 0, we reject the former case; hence the first digit must be 3.  (If the first digit of 2n is less than 3, then the first digit of 5n must be greater than or equal to 3.  If the first digit of 2n is greater than 3, then the first digit of 5n must be less than 3.)

More formally, if 2n and 5n begin with the digit d, then

• d · 10r < 2n < (d + 1) · 10r, and
• d · 10s < 5n < (d + 1) · 10s, for some non-negative integers r and s.

(We have strict inequality because, for n > 0, 2n 0 (modulo 10) 2n 0 (modulo 5), which is impossible by the Fundamental Theorem of Arithmetic.  Similarly for 5n 0 (modulo 10).)

Multiplying the inequalities, we obtain d2 · 10r+s < 10n < (d + 1)2 · 10r+s.
Hence 1 d2 < 10n−r−s < (d + 1)2 100.  (Since d is a decimal digit.)
It follows that n − r − s = 1, so that d2 < 10 < (d + 1)2, and d = 3.

Therefore, if the numbers 2n and 5n (where n is a positive integer) start with the same digit, then that digit must be 3.

## Remarks

We did not prove above that there are any values of n for which 2n and 5n both begin with the same digit; we proved only that if such examples exist, then that digit must be 3.  However, it is easily seen that such examples do exist.  The first few cases are: n = 5, 15, 78, 88, 98, 108, 118, 181, 191, 201, 211, 274, 284, 294, 304, ... .  Notice that there tend to be runs of several numbers with a difference of 10.  This is because 210 103 and 510 107.