Question: I would like to solve this problem using the idea of congruence module m, but I have no idea how to start. Could someone help me?

If $n> 0$ and $n$ is not a multiple of $3$, prove that $a = 3^{2n} + 3^n + 1$ is divisible by $13$.

Answer: 
Here is a solution using the observation in [Cauchy's proof of Basel problem](https://en.wikipedia.org/wiki/Basel_problem#Cauchy%27s_proof).

> 
> **Lemma.** We have
> $$ \prod\_{k=1}^{n} \left( t - \tan^2\left(\frac{k\pi}{2n+1}\right)\right) = \sum\_{k=0}^{n} (-1)^{n-k}\binom{2n+1}{2k+1} t^k. \tag{\*} $$
> 
> 
> 

Using this, we immediately know that

$$ a = \sum\_{k=1}^{n} \tan^2\left(\frac{k\pi}{2n+1}\right) = \binom{2n+1}{2} = n(2n+1) $$

and

$$ b = \prod\_{k=1}^{n} \tan^2\left(\frac{k\pi}{2n+1}\right) = \binom{2n+1}{1} = 2n+1. $$

So the ratio $a/b$ is exactly $n$. In OP's case, $n = 8$ and hence the answer is $8$.

---

*Proof of Lemma.* Write $m = 2n+1$. Then by the de Moivre's formula,

\begin{align\*}
\frac{\cos(mx) + i\sin(mx)}{\cos^m x} = \left( \frac{\cos x + i\sin x}{\cos x} \right)^m = (1 + i\tan x)^m = \sum\_{k=0}^{m} \binom{m}{k} (i\tan x)^k.
\end{align\*}

Taking the imaginary parts only and plugging $m = 2n+1$ back,

\begin{align\*}
\frac{\sin((2n+1)x)}{\cos^{2n+1} x} = \sum\_{k=0}^{n} (-1)^k \binom{m}{2k+1} \tan^{2k+1} x,
\end{align\*}

and so,

\begin{align\*}
(-1)^n \frac{\sin((2n+1)x)}{\sin x \cos^{2n} x} = \sum\_{k=0}^{n} (-1)^{n-k} \binom{m}{2k+1} \tan^{2k} x.
\end{align\*}

However, the left-hand side becomes zero if $x\_k = \frac{k\pi}{2n+1}$ for $k = 1, \dots, n$, and also note that $\tan^2(x\_k)$ for $k = 1, \dots, n$ are all different. So, denoting the right-hand side of $\text{(\*)}$ by $P(t)$, i.e., writing

$$ P(t) = \sum\_{k=0}^{n} (-1)^{n-k}\binom{2n+1}{2k+1} t^k, $$

then this implies that $P(\tan^2(x\_k)) = 0$ for $k = 1, \dots, n$, hence $\tan^2(x\_k)$ for $k = 1, \dots, n$ are $n$ distinct zeros of $P(t)$. Since the leading coefficient of $P(t)$ is $1$, this proves $\text{(\*)}$.
$$=∑\_{=1}^8 tan^2(\frac{}{17})=136$$

$$b=\prod\_{=1}^8 tan^2(\frac{}{17})= 17$$

$$\frac{a}{b}=\frac{136}{17}=8$$

This results can be calculated by hand.

$${Tan[\frac{}{17}]^2, Tan[(2\frac{}{17}]^2, Tan[(3 \frac{}{17}]^2, 
 Tan[(4 \frac{}{17}]^2, Cot[(7 \frac{}{34}]^2, Cot[(5 \frac{}{34}]^2, 
 Cot[(3 \frac{}{34}]^2, Cot[\frac{}{34}]^2}$$

$${0.0349437, 0.15008, 0.383376, 0.831052, 1.75354, 4.03315, 12.3527, \
116.461}$$

This confirms the formulas by [@sangchul-lee](https://math.stackexchange.com/users/9340/sangchul-lee): [Cauchys proof of the Basel lemma](https://en.wikipedia.org/wiki/Basel_problem#Cauchy%27s_proof) but with the figures calculated.