39 Assuming the octal representation of the positive integer $N$ is
$$
N=(12345677654321)_{8},
$$

then among the following four statements, the correct one is
A. $N$ is divisible by 7 but not by 9
B. $N$ is divisible by 9 but not by 7
C. $N$ is not divisible by 7 nor by 9
D. $N$ is divisible by both 7 and 9
39 D. Since $8 \equiv 1(\bmod 7)$, we have $8^{i} \equiv 1(\bmod 7)$, hence
$$
N=\left(a_{2 n-1} \cdot a_{2 n-2} \cdots a_{1} a_{0}\right)_{8}=\sum_{i=0}^{2 n-1} a_{i} 8^{i} \equiv \sum_{i=0}^{2 n-1} a_{i}(\bmod 7),
$$

i.e., $N$ is divisible by 7 $\Leftrightarrow$ the sum of the digits in the octal representation of $N$ is divisible by 7. The given $N$ clearly satisfies this.
Furthermore, since $8 \equiv-1(\bmod 9)$, we have $8^{i} \equiv(-1)^{i}(\bmod 9)$, hence
$$
\begin{aligned}
N & =\left(a_{2 n-1} a_{2 n-2} \cdots a_{1} a_{0}\right)_{8} \equiv \sum_{i=0}^{2 n-1} a_{i}(-1)^{i} \\
& \equiv\left(a_{0}+a_{2}+\cdots+a_{2 n-2}\right)-\left(a_{1}+a_{3}+\cdots+a_{2 n-1}\right)(\bmod 9),
\end{aligned}
$$

i.e., $N$ is divisible by 9 $\Leftrightarrow$ in the octal representation of $N$, the difference between the sum of the digits in the odd positions and the sum of the digits in the even positions is divisible by 9. The given $N$ clearly satisfies this condition.