A certain integer has $4$ digits when written in base $8$. The same integer has $d$ digits when written in base $2$. What is the sum of all possible values of $d$?
I need to find the smallest and largest integers that have $4$ digits in base $8$. The smallest such integer is $1000_8$, which is $8^3 = 512$ in base $10$. The largest such integer is $7777_8$, which is $8^4 - 1 = 4095$ in base $10$. Now I need to convert these integers to base $2$ and count the digits. $512$ in base $2$ is $1000000000_2$, which has $10$ digits. $4095$ in base $2$ is $111111111111_2$, which has $12$ digits. So the possible values of $d$ are $10, 11,$ and $12$. The sum of these values is $10 + 11 + 12 = 33$.

