I am trying to solve an exercise from the book "Theory of Numbers" by B.M.Stewart. The exercise is the following one:
Let $T=2^ap_1^{a_1}p_2^{a_2} \dots p_n^{a_n}$, where $a \ge0, n\ge0, 2<p_1<p_2<\dots p_n, p_j$ odd prime numbers $ \forall j=1 \dots n,a_j \ge1$ and let $S(T)$ indicate the number of primitive Pythagorean triplets of side $T$. Show that $S(T) = 2^{n-1}$ if $a=0$.
The primitive Pythagorean triplets are the solutions of $x^2+y^2=z^2$ where $\gcd(x,y,z)=1$ and they are given by $$\cases {x=2uv \\y=u^2-v^2\\z=u^2+v^2\\u>v>0\\ \gcd(u,v)=1\\ u \not\equiv v \pmod2} $$
If $a=0$ then $T=p_1^{a_1}p_2^{a_2} \dots p_n^{a_n}$, so $T \ne 2uv$. Then $T=y$ or $T=z$.
If $T=y$, then $$T=u^2-v^2=(u+v)(u-v)=p_1^{a_1}p_2^{a_2} \dots p_n^{a_n}.$$ So for $(u+v)$ I have $2^n$ possibilities because I can count the number of prime factors which is $\tau(r)$ with $r=p_1p_2 \dots p_n$.
From there I don't know how to proceed. Have you any idea?
You're awfully close, if you accept my comment that only the $T=y$ case needs to be considered. It follows from $\gcd(u,v)=1, u \not\equiv v \pmod2$ that $\gcd(u+v,u-v)=1.$ There are $2^n$ ways to split $T$ up into a pair of relative prime factors, and the larger one must be $u+v,$ so you just solve two linear equations for $u$ and $v$.
EDIT Suppose we had $T=3^2\cdot5\cdot7.$ We could split this into two the factors $9$ and $35$. Then we would have to solve $$\begin{align}u+v &=35\\u-v&=9\end{align}$$ so $u=22,v=13.$
We have to divide the number of solutions by $2$ because we could always have to make $u+v$ the larger factor, so half the choices are inadmissible.