Probability & Statistics

Cubic of an Integer

A random integer up to a trillion. How often does its cube end in the digits 11?

solvedmedium1 min

Let xx be an integer chosen uniformly between 11 and 101210^{12}. What is the probability that x3x^3 ends in the digits 1111?

Reveal solutionHide solution

#Only the last two digits matter

The last two digits of x3x^3 depend only on the last two digits of xx, since every higher place of xx adds a multiple of 100100 to the cube. So the question is really about xmod100x \bmod 100, and I can pin it down one digit at a time.

#The units digit

A cube ends in 11 only when its base does. Running the units digit dd from 00 to 99, the cubes end in 0,1,8,7,4,5,6,3,2,90, 1, 8, 7, 4, 5, 6, 3, 2, 9, and 11 appears exactly once, at d=1d = 1. So xx ends in 11.

#The tens digit

Write x=10a+1x = 10a + 1, where aa collects the digits above the units. Then

x3=(10a+1)3=1000a3+300a2+30a+130a+1(mod100),(1)x^3 = (10a + 1)^3 = 1000a^3 + 300a^2 + 30a + 1 \equiv 30a + 1 \pmod{100}, \tag{1}

because the first two terms are multiples of 100100. Ending in 1111 asks for 30a+11130a + 1 \equiv 11, that is 3a1(mod10)3a \equiv 1 \pmod{10}. Since 33 is invertible modulo 1010, the unique solution is a7a \equiv 7, so x71(mod100)x \equiv 71 \pmod{100}. A quick check gives 713=35791171^3 = 357911.

1..01
11..31
21..61
31..91
41..21
51..51
61..81
71..11
81..41
91..71
Only integers ending in 1 can cube to a number ending in 1. Among the ten such residues modulo 100, the cube's last two digits run through every value of the form 30a + 1, and exactly one of them, 71, lands on 11.

#The probability

Exactly one residue in every hundred consecutive integers cubes to a number ending in 1111. The range 11 to 101210^{12} holds 1012/100=101010^{12} / 100 = 10^{10} of them, so the probability is

10101012=1100.(2)\frac{10^{10}}{10^{12}} = \frac{1}{100}. \tag{2}

Nothing here leans on the value 101210^{12} beyond its being a multiple of 100100. The density of integers whose cube ends in 1111 is exactly 1/1001/100.