3.2.3 ** Let $g(n)$ denote the greatest odd divisor of the positive integer $n$, for example, $g(3)=3, g(14)=7$, etc. Find the value of $g(1)+g(2)+g(3)+\cdots+g\left(2^{n}\right)$.
Let $S_{n}=g(1)+g(2)+g(3)+\cdots+g\left(2^{n}\right)$, then $S_{1}=g(1)+g(2)=2$. According to the problem, when $k$ is a positive integer, $g(2 k)=g(k)$; when $k$ is an odd integer, $g(k)=k$. Therefore, for positive integers $n \geqslant 2$, we have
$$
\begin{array}{c}
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]= \\
\underbrace{1+3+\cdots+\left(2^{n}-1\right)}_{\text {the first } 2^{n-1} \text { odd numbers }}+\left[g(1)+g(2)+\cdots+g\left(2^{n-1}\right)\right]=4^{n-1}+S_{n-1}, \text { i.e., } S_{n}- \\
S_{n-1}=4^{n-1}(n \geqslant 2), \text { hence } S_{n}=S_{1}+\sum_{i=2}^{n}\left(S_{i}-S_{i-1}\right)=2+\sum_{i=2}^{n} 4^{i-1}=\frac{1}{3}\left(4^{n}+2\right) .
\end{array}
$$