We need to find the probability that a randomly chosen 6-digit number formed using only digits 1 and 8 is a multiple of 21, and then compute 96p.
First, each of the 6 positions can be either 1 or 8, so the total number of such 6-digit numbers is 26=64.
Next, a 6-digit number with digits d1d2d3d4d5d6 where each di∈{1,8} can be written as
N=∑i=16di⋅106−i.
Now we set di=1+7bi where bi∈{0,1} to obtain
N=∑i=16(1+7bi)⋅106−i=111111+7∑i=16bi⋅106−i.
Now we check divisibility by 21, noting that 21=3×7. For divisibility by 3, the digit sum must be divisible by 3. If k of the digits are 8 and the remaining (6−k) are 1, then the digit sum is
8k+(6−k)=6+7k.
Since
6+7k≡0(mod3)⟺7k≡0(mod3)⟺k≡0(mod3),
we conclude that k∈{0,3,6}.
For divisibility by 7, observe that
N=111111+7MwhereM=∑i=16bi⋅106−i,
and since 111111=7×15873 it follows that N is always divisible by 7.
Therefore, the favorable outcomes occur when k∈{0,3,6}, giving
(06)+(36)+(66)=1+20+1=22.
Finally, the required probability is
p=6422=3211,
and hence
96p=96×3211=3×11=33.
Hence the answer is 33.