Cube Ending in 11: A Random Integer up to 10^12
An integer $x$ is chosen uniformly at random from $\{1, 2, \ldots, 10^{12}\}$. What is the probability that the decimal representation of $x^3$ ends in the two digits $11$?
Hints
- The last two digits of $x^3$ depend only on the last two digits of $x$. Write $x = a + 10b + 100c$ with $a, b \in \{0, \ldots, 9\}$ and reduce $x^3$ modulo 100.
- $(a + 10b)^3 \equiv a^3 + 30 a^2 b \pmod{100}$. First force the units digit of $x^3$ to be 1: which $a$ works?
- With $a = 1$ you need $1 + 30b \equiv 11 \pmod{100}$, i.e. $3b \equiv 1 \pmod{10}$. Exactly one $b$ satisfies this, so exactly one residue mod 100 works.
Worked Solution
How to Think About It: Since $10^{12}$ is a multiple of $100$, the last two digits of $x$ are uniform over $00$ through $99$, and the last two digits of $x^3$ depend only on them. So the problem is: how many residues $r \in \{0, \ldots, 99\}$ satisfy $r^3 \equiv 11 \pmod{100}$? Attack the units digit first, then the tens digit.
Quick Estimate: Cubing permutes the ten possible units digits, so about $1/10$ of integers have cubes ending in 1; among those, a further $1/10$ should have the right tens digit, for roughly $1/100$. The exact analysis confirms exactly one residue works.
Formal Solution:
*Step 1 -- Reduce modulo 100.* Write $x = a + 10b + 100c$ with digits $a, b$. Then modulo 100,
$$x^3 \equiv (a + 10b)^3 = a^3 + 30a^2 b + 300ab^2 + 1000b^3 \equiv a^3 + 30 a^2 b \pmod{100}.$$
*Step 2 -- Units digit.* We need $a^3 \equiv 1 \pmod{10}$. The cubes of $0, \ldots, 9$ end in $0, 1, 8, 7, 4, 5, 6, 3, 2, 9$ respectively, so $a = 1$ is the unique solution.
*Step 3 -- Tens digit.* With $a = 1$: $x^3 \equiv 1 + 30b \pmod{100}$. We need $1 + 30b \equiv 11$, i.e. $30b \equiv 10 \pmod{100}$, i.e. $3b \equiv 1 \pmod{10}$, whose unique digit solution is $b = 7$ (since $3 \cdot 7 = 21$).
*Step 4 -- Count.* So $x^3$ ends in $11$ exactly when $x$ ends in $71$. Check: $71^3 = 357{,}911$. Among $1, \ldots, 10^{12}$ exactly $10^{10}$ integers end in $71$, so
$$P = \frac{10^{10}}{10^{12}} = \frac{1}{100}.$$
Answer: $P = \dfrac{1}{100}$; the cube ends in $11$ exactly when $x$ ends in $71$.
Intuition
Cubing is a bijection on the units digits (each digit $0$ through $9$ has a unique cube-root digit), and once the units digit is pinned the tens digit is determined by a linear congruence with a unique solution. So exactly one two-digit ending ($71$) produces a cube ending in $11$, giving probability $1/100$. The reduction "only the last $k$ digits of $x$ affect the last $k$ digits of $x^3$" is the key modular-arithmetic habit; it is the same reasoning that makes hash-bucket and residue-class arguments work in coding interviews.