B3. The doubling sum function is defined by
$$
D(a, n)=\overbrace{a+2 a+4 a+8 a+\ldots}^{n \text { terms }} .
$$

For example, we have
$$
D(5,3)=5+10+20=35
$$
and
$$
D(11,5)=11+22+44+88+176=341 .
$$

Determine the smallest positive integer $n$ such that for every integer $i$ between 1 and 6 , inclusive, there exists a positive integer $a_{i}$ such that $D\left(a_{i}, i\right)=n$.
Solution: Since $D(a, n)=a\left(2^{n}-1\right)$, we have
$$
\begin{array}{l}
D\left(a_{1}, 1\right)=a_{1}=n \\
D\left(a_{2}, 2\right)=3 a_{2}=n \\
D\left(a_{3}, 3\right)=7 a_{3}=n \\
D\left(a_{4}, 4\right)=15 a_{4}=3 \times 5 \times a_{4}=n \\
D\left(a_{5}, 5\right)=31 a_{5}=n \\
D\left(a_{6}, 6\right)=63 a_{6}=3^{2} \times 7 \times a_{6}=n
\end{array}
$$

Hence $3^{2} \times 5 \times 7 \times 31=9765 \mid n$. Thus the smallest solution is $n=9765$.
Note:
$$
\begin{aligned}
D(9765,1) & =9765 \\
D(3225,2) & =3255+6510=9765 \\
D(1395,3) & =1395+2790+5580=9765 \\
D(651,4) & =651+1302+2604+5208=9765 \\
D(315,5) & =315+630+1260+2520+5040=9765 \\
D(155,6) & =155+310+620+1240+2480+4960=9765
\end{aligned}
$$

The answer is 9765 .