Is there another formula which generates Pythagoras' triples such that the largest $2$ of the triple differ by $3$?

I was thinking about Pythagoras' triples recently, and I wondered if I could find a formula that generated Pythagorean triples such that the largest of $$2$$ numbers of the triple differ by $$1$$, and I succeeded in doing so: $$(2m^2+2m+1)^2=(2m^2+2m)^2+(2m+1)^2$$ I found this formula by observing that if $$(x+1)^2-x^2=2x+1$$ is also a square it must be of the form $$(2m+1)^2=4m^2+4m+1$$, and the rest is simple. I then tried to find a formula that generated Pythagorean triples such that the largest of $$2$$ numbers of the triple differ by $$2$$, and once more I succeeded in doing so, using a very similar method: $$(m^2+1)^2=(m^2-1)^2+(2m)^2$$ which in hindsight is just a special case of the general Pythagoras triple formula $$(m^2+n^2)^2=(m^2-n^2)^2+(2mn)^2$$ with $$n=1$$.

However, when I tried to use the same method to find a formula that generated Pythagorean triples such that the largest of $$2$$ numbers of the triple differ by $$\mathbf{3}$$, all I succeeded in finding was the not very helpful $$(6m^2+6m+3)^2=(6m^2+6m)^2+(6m+3)^2$$ which is just the first identity but with both sides multiplied by $$9$$.

Question: Is there another formula which generates Pythagoras' triples such that the largest $$2$$ of the triple differ by $$3$$?

I'd also prefer it if at least $$2$$ of out of the triple are coprime.

• Side note: it's a good exercise to prove that if two of the three integers in a Pythagorean triple are coprime, then every pair of two of those three integers are coprime. Apr 29, 2021 at 17:37

The formula in the OP is the best that can be done. If $$(n+3)^2-n^2$$ is to be a perfect square, that means $$6n+9$$ is a perfect square. But $$6n+9\equiv 6n\pmod 9$$, and the only squares modulo $$9$$ are $$0,1,4,7$$; since $$\gcd(6n,9)\ne1$$, the only possibility is that $$6n\equiv0\pmod 9$$, or equivalently that $$n$$ is a multiple of $$3$$.
• Thanks a lot! I didn't think of using modulo $9$. Thanks also for your your comment, I'll have a go at it. Apr 29, 2021 at 19:39
Euclid's formula used in the OP will generate primitives, doubles, and squares of primitives without a multiplier but not one of these has a difference of $$3$$ between elements. The only way to get this is to find a triple with a difference of $$1$$ between elements and multiply the triple by $$3$$.
I developed a new formula which generates all Pythagorean Triples where $$C-B=(2x-1)^2, x\in\mathbb{N}\space\cdots$$ which includes all primitives. This formula
\begin{align*} A=(2n-1)^2+ &\quad 2(2n-1)k \\ B= \qquad &\quad 2(2n-1)k+ 2k^2\\ C=(2n-1)^2+ &\quad 2(2n-1)k+ 2k^2\\ \end{align*} produces produces the triples shown in the table below. $$\begin{array}{c|c|c|c|c|c|c|} n & k=1 & k=2 & k=3 & k=4 & k=5 \\ \hline Set_1 & 3,4,5 & 5,12,13& 7,24,25& 9,40,41& 11,60,61 \\ \hline Set_2 & 15,8,17 & 21,20,29 &27,36,45 &33,56,65 & 39,80,89 \\ \hline Set_3 & 35,12,37 & 45,28,53 &55,48,73 &65,72,97 & 75,100,125 \\ \hline Set_{4} &63,16,65 &77,36,85 &91,60,109 &105,88,137 &119,120,169\\ \hline Set_{5} &99,20,101 &117,44,125 &135,72,153 &153,104,185 &171,140,221 \\ \hline Set_{6} &43,24,145 &165,52,173 &187,84,205 &209,120,241 &231,160,281 \\ \hline \end{array}$$
We can see that all members in the first $$Set$$ have $$\space C-B=1 \space$$ and we can generate all triples where $$C-B=3$$ by multiplying each term by three. $$Set_1$$ alone can be generated by setting $$n=1$$ and combining these facts, we can generate all triples where $$C-B=3$$ with the following \begin{align*} A=3(1+ &\space 2k \qquad\space)\\ B=3( \quad &\space 2k+ 2k^2)\\ C=3(1+ &\space 2k+ 2k^2)\\ \end{align*}