This took me some time to solve. Here you go:
First, we find this:
$$\begin{aligned}
(\sqrt{13+\sqrt{a}}-\sqrt{13-\sqrt{a}})^2
&=13+\sqrt{a}+13-\sqrt{a}-2\sqrt{13+\sqrt{a}}\sqrt{13-\sqrt{a}}\\
&=2(13-\sqrt{169-a})
\end{aligned}$$
So,
$$\sqrt{13+\sqrt{a}}-\sqrt{13-\sqrt{a}}=\sqrt{2}\sqrt{13-\sqrt{169-a}}$$
By what we have, we write,
$A-B=\sqrt{2}B$
What I used here is the fact that I've summed over all $a$ from $1$ to $168$, and that summing with $\sqrt{169-a}$ is the same as summing with $\sqrt{a}$ in this question.
Now, we have $A=(1+\sqrt{2})B$
Thus, $\frac{A}{B}=1+\sqrt{2}$ and $\frac{B}{A}=\sqrt{2}-1$
We just calculate $(\frac{A}{B})^{13}$ and $(\frac{B}{A})^{13}$ which I believe is okay to be done using calculator. Else, comment so I can edit my answer.