For a positive integer $n$, let $f_n(x)=\cos (x) \cos (2 x) \cos (3 x) \cdots \cos (n x)$. Find the smallest $n$ such that $\left|f_n^{\prime \prime}(0)\right|>2023$.
1. Define the function \( f_n(x) = \cos(x) \cos(2x) \cos(3x) \cdots \cos(nx) \).
2. To find \( f_n''(0) \), we first need to compute the first and second derivatives of \( f_n(x) \).

   Using the product rule for differentiation, we have:
   \[
   f_n'(x) = \sum_{k=1}^n \left( -k \sin(kx) \prod_{\substack{j=1 \\ j \neq k}}^n \cos(jx) \right)
   \]
   Evaluating \( f_n'(x) \) at \( x = 0 \):
   \[
   f_n'(0) = \sum_{k=1}^n \left( -k \sin(0) \prod_{\substack{j=1 \\ j \neq k}}^n \cos(0) \right) = 0
   \]
   because \( \sin(0) = 0 \).

3. Next, we compute the second derivative \( f_n''(x) \):
   \[
   f_n''(x) = \sum_{k=1}^n \left( -k^2 \cos(kx) \prod_{\substack{j=1 \\ j \neq k}}^n \cos(jx) \right) + \text{other terms involving } \sin(kx)
   \]
   Evaluating \( f_n''(x) \) at \( x = 0 \):
   \[
   f_n''(0) = \sum_{k=1}^n \left( -k^2 \cos(0) \prod_{\substack{j=1 \\ j \neq k}}^n \cos(0) \right) = -\sum_{k=1}^n k^2
   \]
   because \( \cos(0) = 1 \).

4. The sum of the squares of the first \( n \) positive integers is given by:
   \[
   \sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}
   \]

5. We need to find the smallest \( n \) such that \( \left| f_n''(0) \right| > 2023 \):
   \[
   \left| -\sum_{k=1}^n k^2 \right| = \sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6} > 2023
   \]
   This simplifies to:
   \[
   n(n+1)(2n+1) > 2023 \times 6 = 12138
   \]

6. We test values of \( n \) to find the smallest \( n \) that satisfies the inequality:
   - For \( n = 17 \):
     \[
     17 \times 18 \times 35 = 10710 \quad (\text{not sufficient})
     \]
   - For \( n = 18 \):
     \[
     18 \times 19 \times 37 = 12654 \quad (\text{sufficient})
     \]

Therefore, the smallest \( n \) such that \( \left| f_n''(0) \right| > 2023 \) is \( n = 18 \).

The final answer is \( \boxed{18} \)