4 Find the largest positive integer $k$, such that there exists a positive integer $n$, satisfying $2^{k} \mid 3^{n}+1$.


4. Notice that, when $n$ is even, let $n=2 m$, we have
$$3^{n}=9^{m} \equiv 1(\bmod 8)$$

When $n=2 m+1$,
$$3^{n}=9^{m} \times 3 \equiv 3(\bmod 8)$$

Therefore, for any positive integer $n$, we have
$$3^{n}+1 \equiv 2 \text { or } 4(\bmod 8),$$

so $k \leqslant 2$. Also, $2^{2} \mid 3^{1}+1$, hence, the maximum value of $k$ is 2.