12. For the geometric sequence $\left\{a_{n}\right\}$ with the first term $a_{1}=1536$, and common ratio $q=-\frac{1}{2}$, let $f(n)$ denote the product of its first $n$ terms. What is $n$ when $f(n)$ reaches its maximum value?
12. The general term formula of the geometric sequence $\left\{a_{n}\right\}$ is $a_{n}=1536 \times\left(-\frac{1}{2}\right)^{n-1}$, and the product of the first $n$ terms is $f(n)=1536^{n} \times\left(-\frac{1}{2}\right)^{\frac{n(n-1)}{2}}$.
First, consider the absolute value of $f(n)$, denoted as $b_{n}=|f(n)|=1536^{n} \times\left(\frac{1}{2}\right)^{\frac{n(n-1)}{2}}$.
By $\frac{b_{n}+1}{b_{n}}=1536 \times\left(\frac{1}{2}\right)^{n}, 2^{10}=1024$, we know that when $n<11$, $b_{n+1}<b_{n}$, i.e., $b_{11}>b_{10}>b_{9}>\cdots>b_{1}$; when $n \geqslant 11$, $b_{n+1}>b_{n}$, i.e., $b_{12}>b_{13}>b_{14}>\cdots$.
Therefore, the maximum value of the absolute value of $f(n)$ is $b_{11}$, but $f(11)=1536^{11} \times\left(-\frac{1}{2}\right)^{55}<0$, $f(9)=1536^{9} \times\left(-\frac{1}{2}\right)^{36}>0$, so we only need to compare the sizes of $f(12)$ and $f(9)$, and $\frac{f(12)}{f(9)}=1536^{3} \times\left(\frac{1}{2}\right)^{30}>\left(2^{10}\right)^{3} \times\left(\frac{1}{2}\right)^{30}=1 \quad\left(1536>1024=2^{10}\right)$. From this, we infer: $f(12)>f(9)$.
Hence, when $n=12$, $f(n)$ reaches its maximum value, which is $f(12)=1536^{12} \times\left(\frac{1}{2}\right)^{66}=2^{42} \times 3^{12}$.