10. For positive integers $k, g(k)$ represents the greatest odd divisor of $k$ (for example, $g(3)=3, g(20)=5$), find $g(1)+g(2)+$ $g(3)+\cdots+g\left(2^{n}\right)$ (where $n \in \mathbf{N}^{+}$).
10. Let $S_{n}=g(1)+g(2)+g(3)+\cdots+g\left(2^{n}\right)$, then it is easy to see that $S_{1}=g(1)+g(2)=2$. By the definition of $g(k)$: when $k$ is odd, $g(k)=k$; when $k$ is even, i.e., $k=2 m\left(m \in \mathbf{N}^{*}\right)$, $g(k)=g(m)$.
Thus, we have
$$
\begin{aligned}
S_{n}= & {\left[g(1)+g(3)+\cdots+g\left(2^{n}-1\right)\right]+\left[g(2)+g(4)+\cdots+g\left(2^{n}\right)\right] } \\
= & {\left[1+3+\cdots+\left(2^{n}-1\right)\right]+g(1)+(2)+\cdots+g\left(2^{n}-1\right)=\left(2^{n-1}\right)^{2}+S_{n-1}, } \\
\text { i.e., } & S_{n}-S_{n-1}=4^{n-1} .
\end{aligned}
$$

Thus,
So $S_{n}=\left(S_{n}-S_{n-1}\right)+\left(S_{n-1}-S_{n-2}\right)+\cdots+\left(S_{2}-S_{1}\right)+S_{1}=4^{n-1}+4^{n-2}+\cdots+4+2=\frac{4^{n}+2}{3}$.