I found this problem in previous problems of the olympiads of my country

If $t^2+n^2=r^2$, where $t$ has $3$ positive divisors, $n$ has $30$ positive divisors and $t,n,r$ are natural numbers, find the sum of all the possible values of $t$

I did gave it a try but only solved it partially, and I really doubt this is the best way to do it.

My progress:

First, $t$ must be of the form $p^2$ where $p$ is prime

Then, we use pythagorean triplets

Case 1: $$t=p^2=2ab$$ $$n=a^2-b^2$$ Therfore, $p$ must be $2$, therefore $a=2, b=1$, but this does not satisfy $n$ having $30$ divisors.

Case 2: $$t=p^2=a^2-b^2=(a-b)(a+b)$$ $$n=2ab$$ Since $p$ is prime, we get $a=b+1$, therefore $$p^2=2b+1$$ $$n=2(b+1)b$$ If $n$ has $30$ divisors, it must be of one of the forms $$q^{29},r^{14}q,r^{9}q^2,r^4q^5,r^4q^2s$$ Where $r,q,s$ are different primes

Since $p$ is odd, $p^2=8k+1=2b+1$, $b=4k$ for some integer $k$

Case 2.1 $$8k(4k+1)=r^{29}\implies 4k(4k+1)=2^{28}$$ That is clearly impossible

Case 2.2 $$8k(8k+1)=r^{14}q\implies r=2$$

$$4k(4k+1)=2^{13}q$$ $$\implies 4k=2^{13} \implies q=4k+1=2^{13}+1=3×2731$$

Case 2.3 $$8k(4k+1)=r^9q^2\implies r=2$$ $$8k(4k+1)=2^9q^2$$ $$4k(4k+1)=2^8q^2$$ $$\implies 4k=2^8\implies q^2=4k+1=256+1=257$$

Case 2.4 $$8k(4k+1)=r^4q^5$$ Case 2.4.1($r=2$) $$4k(4k+1)=2^3q^5$$ $$\implies 4k=8\implies q^5=4k+1=8+1=9$$ Case 2.4.2($q=2$) $$4k(4k+1)=r^42^4$$ $$\implies 4k=16\implies r^4=4k+1=16+1=17$$

Case 2.5 $$8k(4k+1)=r^4q^2s\implies r=2$$ $$8k(4k+1)=16q^2s$$ $$8k(8k+2)=32q^2s$$ $$(p-1)(p+1)=32q^2s$$ $$p^2-1=32q^2s$$ Where all $p,q,s$ are odd primes

The question now is: how do I proceed from here? Was there an easier way to solve this?

-
@zyx Thank you for the suggestion, done. This comes from second phase of my country's mathematical olympiads. – chubakueno Sep 7 '13 at 2:55
Thank you. I saw that and deleted the suggestion. – zyx Sep 7 '13 at 3:00
There are other cases to consider, since $a^2-b^2, 2ab, a^2+b^2$ does not give all triples. – André Nicolas Sep 7 '13 at 3:17
@AndréNicolas True, it gives all the primitive pythagorean triplets, and I am not sure If I can scale down my three integers to match them in a clean way. If my method cannot be continued, what do you suggest? – chubakueno Sep 7 '13 at 3:21

Let us start as you did. I will assume that $t$, $n$ and $r$ are coprime. Then $t=a^2-b^2$ and $n=2ab$. See the answer of André Nicolas for the case when $t$, $n$ and $r$ are not coprime.

We get that \begin{align*} p^2 &= 2b+1,\\ n &= 2(b+1)b. \end{align*} Therefore, $$n = \frac{p^4-1}{2} = (p-1) \times (p+1) \times \frac{p^2+1}{2}.$$ Note that every prime number $a \neq 2$ divides at most one of the terms $(p-1)$, $(p+1)$, and $\frac{p^2+1}{2}$.

If neither of these terms is a power of 2, then $n$ has at least $4$ prime factors: 2, a prime divisor of $p-1$ (other than 2), a prime divisor of $p+1$ (other than 2), a prime divisor of $\frac{p^2+1}{2}$. This is impossible since $n$ has 30 divisors.

We conclude that one of the numbers $p-1$, $p+1$, $\frac{p^2+1}{2}$ is a power of 2. Note that $\frac{p^2+1}{2}$ is odd. Thus either $p-1$ or $p+1$ is a power of 2.

Note that then $n$ has 3 prime factors: 2, a prime divisor of either $p-1$ or $p+1$ (other than 2), a prime divisor of $\frac{p^2+1}{2}$. So it must be the case that $n=r^4 q^2 s$. Since $n = (p^4-1)/2$ is divisible by 8, we have that $r=2$.

Consider two cases

1. $p-1$ is a power of 2. Observe that $p\neq 3$. Then $p+1$ is divisible by 2 but not by 4. We have $p - 1 = 8$ and $p=9$. Then $n=3280$. But $3280$ has 20 factors.
2. $p+1$ is a power of $2$. Then $p-1$ is divisible by 2 but not by 4. We have $p + 1 = 8$ and $p=7$. Then $n = 1200$. We check that 1200 has 30 factors.

Answer: $t=49$, $n =1200$ and $r=1201$.

-
Thank you! It took me a little to understand your solution, but i like it very much. – chubakueno Sep 7 '13 at 4:16

We add a little to the analysis by Yury. It could be that $a^2-b^2=p$, the odd leg of our triple is $p(a^2-b^2)$, and the even leg $p(2ab)$, where $(a^2-b^2,2ab,a^2+b^2)$ is a primitive triple.

Then $2ab$ must have $15$ divisors. That leaves very few cases, since the power of $2$ that divides the even one of $a$ and $b$ must be $2^1$, $2^3$, or $2^{13}$. The odd one then must be $q^4$, $q^2$, or $1$, where $q$ is prime. A little fooling around shows that we need $b=8$, and therefore $a=9$.

So we get the solution $t=17^2$, $n=(17)(144)$

-
Some questions that I would appreciate if you clarify it to me. How do you know that taking $a^2-b^2=p$ cuts all the remaining cases? Where did you got that $2ab$ must have $15$ divisors?, and finally, how did you eliminated the $2^1$? – chubakueno Sep 7 '13 at 4:36
I just got that since it is a primitive triple, $(a^2-b^2=p,2ab)=1$, therefore $2ab$ must have 15 divisors, but I am still having a hard time with the other parts. – chubakueno Sep 7 '13 at 4:42
Well, $15$ divisors means $2ab=2^{14}$ or $2ab=2^2q^4$ or $2^4q^2$ where $q$ is an odd prime. For the last two cases we need $|q^8-2^2=p|$ (no good) or $|q^4-(2^3)^2|=p$. This forces $q^2-2^3=1$, so $q=3$. – André Nicolas Sep 7 '13 at 4:58
Thank you, also just thought about the restriction that $b=4k$, and you get $8k(4k+1)=2^4p^2\implies k=2$ and saw that the real condition was $(a^2-b^2) |p^2$, so that is where you got the second part of the analysis. Thank you very much. – chubakueno Sep 7 '13 at 5:07
@chubakueno: I did one case, Yury did another somewhat more complicated one, and did it first. The more reasonable thing, if I may offer an opinion, is to accept his. – André Nicolas Sep 7 '13 at 5:11