Suppose that $X$ and $Y$ are angles with $\tan X=\frac{1}{m}$ and $\tan Y=\frac{a}{n}$ for some positive integers $a, m$ and $n$. Determine the number of positive integers $a \leq 50$ for which there are exactly 6 pairs of positive integers $(m, n)$ with $X+Y=45^{\circ}$.

(Note: The formula $\tan (X+Y)=\frac{\tan X+\tan Y}{1-\tan X \tan Y}$ may be useful.)

## PART B

For each question in Part B, your solution must be well organized and contain words of explanation or justification. Marks are awarded for completeness, clarity, and style of presentation. A correct solution, poorly presented, will not earn full marks.
Since $X+Y=45^{\circ}$, then $\tan (X+Y)=\tan 45^{\circ}=1$.

Now, $\tan (X+Y)=\frac{\tan X+\tan Y}{1-\tan X \tan Y}=\frac{\frac{1}{m}+\frac{a}{n}}{1-\frac{1}{m} \cdot \frac{a}{n}}=\frac{m n\left(\frac{1}{m}+\frac{a}{n}\right)}{m n\left(1-\frac{1}{m} \cdot \frac{a}{n}\right)}=\frac{n+a m}{m n-a}$.

Thus, we have $\frac{n+a m}{m n-a}=1$.

We want to determine the number of positive integers $a$ for which this equation has exactly 6 pairs of positive integers $(m, n)$ that are solutions.

Re-arranging the equation, we obtain

$$
\begin{aligned}
\frac{n+a m}{m n-a} & =1 \\
n+a m & =m n-a \\
a & =m n-a m-n \\
a+a & =m n-a m-n+a \\
2 a & =m(n-a)-(n-a) \\
2 a & =(m-1)(n-a)
\end{aligned}
$$

So we want to determine the number of positive integers $a$ for which $(m-1)(n-a)=2 a$ has exactly 6 pairs of positive integers $(m, n)$ that are solutions.

Since $a \neq 0$, then $m-1 \neq 0$ and so $m \neq 1$.

Since $m$ is a positive integer and $m \neq 1$, then $m \geq 2$; in other words, $m-1>0$.

Since $m-1>0$ and $2 a>0$ and $2 a=(m-1)(n-a)$, then $n-a>0$ or $n>a$.

Now, the factorizations of $2 a$ as a product of two positive integers correspond with the pairs $(m, n)$ of positive integers that are solutions to $(m-1)(n-a)=2 a$.

This is because a factorization $2 a=r \cdot s$ gives a solution $m-1=r($ or $m=r+1)$ and $n-a=s$ (or $n=s+a$ ) and vice-versa.

So the problem is equivalent to determining the number of positive integers $a$ with $a \leq 50$ for which $2 a$ has three factorizations as a product of two positive integers, or equivalently for which $2 a$ has six positive divisors.

Given an integer $d$ and its prime factorization $d=p_{1}^{c_{1}} p_{2}^{c_{2}} \cdots p_{k}^{c_{k}}$, where $p_{1}, p_{2}, \ldots, p_{k}$ are distinct prime numbers and $c_{1}, c_{2}, \ldots, c_{k}$ are positive integers, the number of positive divisors of $d$ is $\left(c_{1}+1\right)\left(c_{2}+1\right) \cdots\left(c_{k}+1\right)$.

In order for this product to equal $6, d$ must have the form $p^{5}$ for some prime number $p$ or $p^{2} q$ for some prime numbers $p$ and $q$. This is because the only way for 6 to be written as the product of two integers each larger than one is $2 \cdot 3$.

In other words, we want $2 a$ to be the fifth power of a prime, or the square of a prime times another prime.

If $2 a$ is of the form $p^{5}$, then $p=2$ since $2 a$ is already divisible by 2 . Thus, $2 a=2^{5}=32$ and so $a=16$.

If $2 a$ is of the form $p^{2} q$, then $p=2$ or $q=2$ since $2 a$ is already divisible by 2 .

If $p=2$, then $2 a=4 q$. Since $a \leq 50$, then $2 a \leq 100$ or $q \leq 25$, and so $q$ can equal $3,5,7,11,13,17,19,23$, giving $a=6,10,14,22,26,34,38,46$. (Note that $q \neq 2$.)

If $q=2$, then $2 a=2 p^{2}$. Since $2 a \leq 100$, then $p^{2} \leq 50$ and so the prime $p$ can equal $3,5,7$ giving $a=9,25,49$. (Note that $p \neq 2$.)

Therefore, in summary, there are 12 such values of $a$.

## Part B