COMC 2018 B Problem 3

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.