3

I want to “rank” [primitive] Pythagorean triples by some metric that could reasonably be referred to as “size”.

Naturally, there are a huge number of options: size of hypotenuse, size of smallest leg, perimeter, area, radius of incircle, etc. etc. etc. (Note: One thing I don’t want to use is the row index from the triple’s position in one of the infinite ternary trees.)

Is there a widely-accepted “sizing” of triples? What are the pros and cons of various metrics?

EDIT (inspired by Gerry Myerson’s comment): The “Holy Grail” in this investigation would be a strictly “linear” ordering of the Pythagorean triples. Does (or can) such a thing exist?

EDIT #2: Let $(p,q)$ be the Euclid generating pair for a primitive Pythagorean triple. Applying the Cantor pairing function with $p-q$ and $q$ gives a unique integer value for each triple, which generally correlates with “size”; and I have yet to find anything more compact (e.g., in a set of $38$ of the “smallest” triples, the area-divided-by-6 range is $1–1820$, while the Cantor function for the same set has a range of $4–106$). What’s clearly missing is any obvious way to “descend” through this ordered set.

EDIT #3: The inradius is the most obvious “size” ranking, since the only gaps in the sequence are the powers of $2$. The issue here is the fact that inradius isn’t unique.

Kieren MacMillan
  • 7,889
  • 2
  • 28
  • 70
  • 2
    Which of those options (or others) is the most useful depends on what you want to do with the ranking. That will determine the pros and cons. – Ethan Bolker Jul 16 '21 at 21:19
  • @EthanBolker: I’m trying to find a rigorous descent path that isn’t the ternary tree. – Kieren MacMillan Jul 16 '21 at 21:38
  • 1
    I don't know what you mean by "a rigorous descent path", but if what you mean is a linear ordering that enables you to derive the $n$th triple from the one before it, I'll bet there's no such thing (other than a traversal of the ternary tree you don't want). – Gerry Myerson Jul 17 '21 at 13:25
  • @GerryMyerson: A “perfect” linear ordering would, of course, be the Holy Grail; I share your pessimism that such a thing exists. That being said, since posting this yesterday, I have discovered a descent mechanism which (a) is predictable/quantifiable, (b) avoids negative side lengths completely, and (c) does not reference the ternary tree [directly] — that is 95% of my goal (the last 5% being true “linearity”). – Kieren MacMillan Jul 17 '21 at 14:09
  • @GerryMyerson: Here’s a modified answer/request… Can you think of a way to “reorder” (“weave through”) one of the ternary trees such that the path taken “descends” [by some known/fixed metric] from an arbitrary PPT to the fundamental triple (3,4,5) but each step “down” always yields positive values for all three sides [without relying on the absolute value function or “manual” sign changes]? – Kieren MacMillan Jul 17 '21 at 14:20
  • 1
    The Wikipedia article gives you three matrices $A,B,C$ such that every primitive triple can be written in a unique way as a word in $A,B,C$ times $(3,4,5)$. So given a primitive triple $v$, exactly one of the three vectors $A^{-1}v,B^{-1}v,C^{-1}v$ is a primitive triple. This gives you a way to work back to $(3,4,5)$. https://en.wikipedia.org/wiki/Tree_of_primitive_Pythagorean_triples – Gerry Myerson Jul 18 '21 at 01:48
  • @GerryMyerson: Yes, but (a) that’s just the ternary tree, and (b) the transformations given don’t deal with the sign issue [as far as I can tell]. Those are exactly the two issues I‘m trying to avoid — especially the sign issue. – Kieren MacMillan Jul 18 '21 at 01:51
  • There isn't any sign issue. If you multiply a triple with positive entries by any of those three matrices, you get a triple with positive entries. And it's not just the ternary tree – it's the ternary tree together with a way to get back to the root from an arbitrary node. – Gerry Myerson Jul 18 '21 at 02:01
  • @GerryMyerson: Every answer given in https://math.stackexchange.com/questions/965206/how-to-descend-within-the-tree-of-primitive-pythagorean-triples says there’s a sign issue to deal with. If you know differently, please give an answer below — I’ll happily upvote (and possibly accept) it! – Kieren MacMillan Jul 18 '21 at 02:10
  • $C-B$ is an odd square for all primitives. Does this ternary tree contain selected non-primitives such as $(27,3,45)$? If so, I may have a solution that works: One-to-one mapping in a pattern that can be diagonally matched to natural numbers and which corresponds to increasing product. It would depend on adding such as [the missing] $(27,36,45)$ to the list below.

    $$(3,4,5)\quad (5,12,13)\quad (15,8,17)\quad (7,24,25)\quad (21,20,29)\ (35,12,37)\quad (9,40,41)\quad (11,60,61)\quad (63,16,65)\quad (45,28,53)$$

    – poetasis Jul 18 '21 at 17:27
  • @poetasis: The two “official” ternary trees contain all the primitive PPTs and no imprimitive ones. (That‘s part of their attraction.) I may be able to use an enumeration/descent which includes imprimitive triples, so please do share the result of your “diagonal enumeration” idea, if you ever get it to a shareable state! – Kieren MacMillan Jul 18 '21 at 21:08
  • 1
    The $F(n,k)$ numbers for my formula that yield triples in product order have no pattern that I see so far. $$ (1,1)\quad (1,2)\quad (2,1)\quad (1,3)\ (2,2)\quad (1,4)\quad (3,1)\quad (1,5)\ (2,3)\quad (4,1)\quad (3,2)\quad (2,4)\ (3,3)\quad (5,1)\quad (4,2)\quad (2,5)\ (3,4)\quad (6,1)\quad (4,3)\quad (5,2)\ (3,5)\quad (7,1)\quad (4,4)\quad (6,2)\ (5,3)\quad (8,1)\quad (4,5)\quad (5,4)\ (7,2)\quad (6,3)\quad (9,1)\quad (5,5)\ (8,2)\quad (6,4)\quad (7,3)\quad (10,1)$$ – poetasis Jul 20 '21 at 14:03
  • @Kieren MacMillan I've seen the graph before and actually plotted it from the results of my equations. What i was looking for was a way to pull triples in product size order using some $(n,k)$ pattern to feed my formula – poetasis Jul 20 '21 at 20:34

4 Answers4

3

Given that side-A is odd, side-B is even, and side-C is odd, they take the form of $A = (2x+1), B=4y, C=4z+1), x,y,z\in\mathbb{N}.\quad$ Finding them is a relatively easy but pick any of the three and the solution seems incomplete without the other two. Also, side-A is larger than side-B for half of all triples. (I can demonstrate this if you want.)

Here are some other ratings and methods of finding them. Beginning with Euclid's formula shown here as $ \qquad A=m^2-k^2\qquad B=2mk \qquad C=m^2+k^2.\qquad$ Note: any m-value that yields an integer k-value yields a valid Pythagorean triple.

$\bullet\space$ Perimeter in sizes shown here

\begin{equation} P=2m^2+2mk\implies k=\frac{P-2m^2}{2m}\\ \text{for} \quad \biggl\lfloor\frac{\sqrt{4P+1}+1}{4}\biggr\rfloor\le m \le \biggl\lfloor\frac{\sqrt{2P+1}-1}{2}\biggr\rfloor \end{equation}

The lower limit ensures that $m>k$ and the upper limit insures that $k\ge1$. $$P=286\implies \biggl\lfloor\frac{\sqrt{1144+1}+1}{4}\biggr\rfloor =8\le m \le \biggl\lfloor\frac{\sqrt{572+1}-1}{2}\biggr\rfloor=11\\ \land\quad m\in\{11\}\implies k\in\{2\}$$ $$F(11,2)=(117,44,125)\qquad P=(117+44+125)=286$$

$\bullet\space$ Area:perimeter ratio$\space$ (All are multiples of $\frac{1}{2}$ and here is a way to find them)

$$R=\frac{area}{perimeter}=\frac{AB}{2P}=\frac{2mk(m^2-k^2)}{2(2m^2+2mk)}=\frac{mk-k^2}{2} $$ \begin{equation} R=\frac{mk-k^2}{2}\quad\implies k=\frac{m\pm\sqrt{m^2-8R}}{2}\\\text{for}\quad \big\lceil\sqrt{8R}\big\rceil\le m \le (2R+1) \end{equation} The lower limit insures that $k\in \mathbb{N}$ and the upper limit ensures that $m> k$.

$$R=1\implies \lceil\sqrt{8}\rceil=3\le m \le (2+1)=3 \\\land\qquad m\in\{ 3\}\implies k\in\{ 2,1\}$$ $$F(3,2)=(5,12,13)\space\land\space \frac{30}{30}=1\qquad F(3,1)=(8,6,10)\space\land\space \frac{24}{24}=1$$

$\bullet\space$ Area (Sizes are multiples of $6$ listed in this series). Up to $3$ distinct triples can have the same area.

\begin{equation} k_0=\sqrt{\frac{4m^2}{3}}\cos\biggl({\biggl(\frac{1}{3}\biggr)\cos^{-1}{\biggl(-\frac{3\sqrt{3}D}{2m^4}\biggr)}\biggr)} \\ k_1=\sqrt{\frac{4m^2}{3}}\cos\biggl({\biggl(\frac{1}{3}\biggr)\cos^{-1}{\biggl(\frac{3\sqrt{3}D}{2m^4}\biggr)}\biggr)} \\ k_2=k_1-k_0 \\\qquad\text{ for }\quad\bigg\lfloor\sqrt[\LARGE{4}]{\frac{8D}{3}}\bigg\rfloor \le m \le\big\lceil\sqrt[\LARGE{3}]{D}\big\rceil \end{equation}

$$D=840\implies \lfloor\sqrt[\LARGE{4}]{2(840)}\rfloor=7 \le m \le \lceil\sqrt[\LARGE{3}]{840}\rceil=10\quad\text {and we find}$$ $$m\in \{7\}\implies k\in\{5,8,3\}\qquad\land\qquad m\in\{8\}\implies k\in\{7\}$$ $$\text{We find }\qquad S_{mk}=\{(7,5), (7,8), (7,3), (8,7)\}$$ $$F(7,5)=(24,70,74)\quad F(7,8)=(-15,112,113)\\ F(7,3)=(40,42,58)\quad F(8,7)=(15,112,113)$$

$\bullet\space$ A,B,C product sizes seen here ( All are multiples of $60$. Finding them requires a more convoluted solution available on request.)

$\bullet\space B-A=1$ side difference. An interesting solution to $B-A=1$ was provided by Wacław Sierpiński, $\textit{Pythagorean triangles}$, THE SCRPTA MATHEMATICA STUDIES Number NINE, , GRADUATE SCHOOL OF SCIENCE YESHIVA UNIVERSITY, NEW YORK, 1962, pp. 17-22 with a formula that generates these triples $(T_n)$ sequentially with a starting "seed" of $T_0=(0,0,1)$. \begin{equation}T_{n+1}=3A_n+2C_n+1\qquad B_{n+1}=3A_n+2C_n+2 \qquad C_{n+1}=4A_n+3C_n+2\end{equation}

$$T_1=(3,4,5)\qquad T_2=(20,21,29)\qquad T_3=(119,120,169)\qquad \textbf{ ...}$$

In casual testing, it appears that only the sums and products of A,B,C have unique solutions (only one triple per value) and Area/Perimeter ratio is a pleasing set $\big(R=\big\{\frac{1}{2},\frac{2}{2},\frac{3}{2},\cdots\big\}\big)$ so perhaps one of these are the most "natural" series to pursue.

$\textbf{Update:}$ Gerry Myerson has shown below that perimeter does not map to a unique triple.

poetasis
  • 6,338
  • 1
    There is a link at OEIS to Leon Bernstein, On primitive Pythagorean triangles with equal perimeters, The Fibonacci Quarterly 27.1 (1989) 2-6 where it is shown that for any $k$ there are infinitely many sets of $k$ primitive Pythagorean triples with the same sum. Whether there are two with the same product seems to be an open question. – Gerry Myerson Jul 17 '21 at 13:21
  • @ Gerry Myerson I’m not good enough to follow the paper completely. Can you show me an example of two triples with equal perimeters? – poetasis Jul 17 '21 at 13:40
  • 1
    $(195,748,773)$ and $(364,627,725)$. See also https://oeis.org/A024408 – Gerry Myerson Jul 17 '21 at 13:54
  • @ Gerry Myerson Thanks – poetasis Jul 17 '21 at 14:01
  • This is a very interesting approach. It may suffer from the “perimeter isn’t unique” flaw, but it’s a huge step in the direction I’ve asked about. Thanks! – Kieren MacMillan Jul 17 '21 at 14:22
  • @Kieren MacMillan On the opposite end of the spectrum, there are infinite triples for each “legal” side difference. $$C-B=(2m-1)^2, m\in\mathbb{N}$$ $$C-A=2n^2, n\in\mathbb{N}$$ $$|B-A|=P^n: P\text{ is prime },n\in{0,\mathbb{N}},P^n=\pm1\text{ mod } 8$$ $$\text{i.e. Under }100, |B-A|\in {1,7, 17, 23, 31, 41, 47, 49, 71, 73, 79, 89, 97}$$

    I found solutions for all but the last was most the most challenging and satisfying. Let me know if you would like to see my clumsy research.

    – poetasis Jul 17 '21 at 15:01
  • @Kieren MacMillan I have updated my post (near the end) with a solution for finding (sequentially) the infinite series of triples where $B-A=1$ – poetasis Jul 17 '21 at 15:25
  • Just adding that I have ordered them (PPTs) by leg difference then hypotenuse. Each leg difference, greater than 1, yields two infinite sequences that generate triples with growing hypotenuses. Only one sequence, the Pell numbers, for leg difference of 1. http://rationalargumentator.com/issue232/Pellian.pdf –  Jan 01 '23 at 12:56
2

In all the series I searched, I could not find anything suggesting that any $A\times B\times C$ product represents more than one Pythagorean triple. Here are primitive triple product values.

$$P=(m^2-k^2)(2mk)(m^2+k^2) =2 m^5k - 2 mk^5\implies 2mk^5- 2 m^5k + P=0$$

One method of finding these triples is to find the hypotenuse, divide the product by the hypotenuse to find area, and then find the [one-and-only] triple (by area) that has that hypotenuse. This method was provide by Yuri Negometyanov of Kyiv, Ukraine here.

His logic shows how, for $C$ as a factor of P, we can feel confident that \begin{equation} \sqrt[3]{2P} < C < \frac{\sqrt{(4P)^{\frac{4}{5}}+1 } + 1}{2}\quad \land \quad C\bigg |\frac{P}{12} \end{equation}

Any "candidate" factor in this range must take the form of $(4x+1)$ and must also divide $\dfrac{P}{12}$.

For an example, we will use a product: $P=192720$.

$$P=192720\implies \big\lfloor\sqrt[3]{2(192720)}\big\rfloor = 72 \le C \le \left\lfloor\frac{\sqrt{\big(4(192720)\big)^{\frac{4}{5}}+1 } + 1}{2}\right\rfloor=113$$ $$\land\quad \frac{P}{12} =\frac{192720}{12}=16060$$

Only $4$ of the factors of $192720$ and $2$ of the factors of $16060$ are between $72$ and $113$. In this case only 73 is in "C-format" where $\quad \big(C=4x+1\big)\quad$ and only 73 divides P/12 where $\quad \bigg(\dfrac{16060}{73}=1320\bigg).\quad$ We now substitute $1320$ into the area-formula

\begin{equation} k_0=\sqrt{\frac{4m^2}{3}}\cos\biggl({\biggl(\frac{1}{3}\biggr)\cos^{-1}{\biggl(-\frac{3\sqrt{3}D}{2m^4}\biggr)}\biggr)} \\ k_1=\sqrt{\frac{4m^2}{3}}\cos\biggl({\biggl(\frac{1}{3}\biggr)\cos^{-1}{\biggl(\frac{3\sqrt{3}D}{2m^4}\biggr)}\biggr)} \\ k_2=k_1-k_0 \\\qquad\text{ for }\quad\bigg\lfloor\sqrt[4]{\frac{8D}{3}}\bigg\rfloor \le m \le\big\lceil\sqrt[3]{D}\big\rceil \end{equation}

$$D=1320\implies \lfloor\sqrt[4]{1320}\rfloor=6 \le m \le \lceil\sqrt[3]{1320}\space\rceil=11\quad\land\quad m\in \{8,11\}\implies k\in\{3,1\}$$ $$F(8,3)=(55,48,73)\qquad F(11,1)=(120,22,122)$$

Of these findings, we can see that only one triple has $C=73$ and that $P=55\times48\times73=192720$.

poetasis
  • 6,338
  • I’ll take a look at this — thanks! – Kieren MacMillan Jul 17 '21 at 19:57
  • One value which is apparently unique (https://www.jstor.org/stable/20876243) is $A/s^2$, where $A$ is the area and $s$ is the semiperimeter. – Kieren MacMillan Jul 17 '21 at 19:59
  • @Kieren MacMillan The area/perimeter ratios often have multiple target triples so I think the same problem will arise with semiperimeters. For example $f(5,2)=(21,20,29)$ and $f(7,6)=(13,84,85)$ both have R=3.. If smi-perimeter yields different results, please let me know. – poetasis Jul 17 '21 at 20:41
  • The square in the denominator is the key. $A/s^2 = \frac{n(m-n)}{m(m+n)}$, and because $\gcd(m,n)=1$, that ratio is unique. – Kieren MacMillan Jul 17 '21 at 21:10
  • Another [simpler!] unary and unique enumeration is to simply take the generator $(m,n)$ and consider the rational fraction $n/m$, which falls in the interval $0…1$. See https://en.wikipedia.org/wiki/Pythagorean_triple#Enumeration_of_primitive_Pythagorean_triples – Kieren MacMillan Jul 17 '21 at 21:11
  • But if you use $n/m$, you have to come up with an enumeration of the rationals. Of course, some such enumerations are known, but I doubt they result in anything you'd call natural, as an enumeration of Pythagorean triples. Same comment should apply to $A/s^2$. – Gerry Myerson Jul 18 '21 at 01:19
  • 1
    Also, as I commented elsewhere, whether any $abc$ comes from two different primitive triples is an open question. – Gerry Myerson Jul 18 '21 at 01:30
  • @GerryMyerson: Given an arbitrary PPT with generator $(m,n)$, the Farey sequence of order $n$ gives an obvious enumeration of all “smaller“ PPTs (which is really all that matters in descent!). – Kieren MacMillan Jul 18 '21 at 01:53
2

Too big for a comment.

In 2009, I arranged the smallest primitives in a pattern where the same values of $C-B$ were all in the same respective rows. All were odd squares $(2n-1)^2$ and each A-value increment was $(2n-1)$.

It was then easy develop a new formula $F(n,k)$ and, later, to see that it was the same as Euclid's formula $F(m,k)\quad$ if $\quad F(n,k)=F(2m-1+k,k).$

\begin{align*} A=(2n-1)^2+ &\quad 2(2n-1)k \\ B= \qquad &\quad 2(2n-1)k+ \space 2k^2\\ C=(2n-1)^2+ &\quad 2(2n-1)k+ 2k^2\\ \end{align*}

and here is a sample of the "sets" of triples it produces. \begin{array}{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}

Note that row$_1$ and column$_1$ are all primitives but, for example, $F(2,3)=(27,36,45)$ is non-primitive. This happens any time $k$ is a multiple of any factor of $(2n-1)$. Aside from $Set_1$ where $(2n-1)=1$, if $(2n-1)$ is prime, the following formula will produce only primitives by generating $(2n-1)-(1)$ primitives and then skipping a triple.

\begin{align*} &A=(2n-1)^2+&2(2n-1)\bigg(k+\bigg\lfloor\frac{(k-1)}{(2n-2)}\bigg\rfloor\bigg)&\qquad\\ &B=&2(2n-1)\bigg(k+\bigg\lfloor\frac{(k-1)}{(2n-2)}\bigg\rfloor\bigg)&\qquad+2\bigg(k+\bigg\lfloor\frac{(k-1)}{(2n-2)}\bigg\rfloor\bigg)^2\\ &C=(2n-1)^2+&2(2n-1)\bigg(k+\bigg\lfloor\frac{(k-1)}{(2n-2)}\bigg\rfloor\bigg)&\qquad+2\bigg(k+\bigg\lfloor\frac{(k-1)}{(2n-2)}\bigg\rfloor\bigg)^2 \end{align*}

If $(2n-1)$ is composite, a primitives will occur more often and, perhaps, they may only be counted using the inclusion exclusion principal. For example, we use $Set_{53}, (2n-1)=105$ which has prime factors $3,5,$ and $7$. Below we let X,Y, and Z be "prime counts" when $k=107$. \begin{equation} (X\cup Y\cup Z)=(X)+(Y)+(Z)-(X\cap Y)-(X\cap Z)-(Y\cap Z)+(X\cap Y\cap Z) \end{equation} $$X=\biggl\lfloor\frac{107}{3}\biggr\rfloor=35\qquad Y=\biggl\lfloor\frac{107}{5}\biggr\rfloor=21\qquad X=\biggl\lfloor\frac{107}{7}\biggr\rfloor=15$$ $$X\cap Y=\biggl\lfloor\frac{107}{3*5}\biggr\rfloor=7\quad X\cap Z=\biggl\lfloor\frac{107}{3*7}\biggr\rfloor=5\quad Y\cap Z=\biggl\lfloor\frac{107}{5*7}\biggr\rfloor=3$$ $$ X\cap Y\cap Z=\biggl\lfloor\frac{107}{3*5*7}\biggr\rfloor=1$$

$$\text{The "multiple count" is }\quad X\cup Y\cup Z=35+21+15-7-5-3+1=57$$ \par Out of $107$ triples for $n=53\land k=107$ the number of primitives is $107-57=50$.

But the whole point of this presentation is to show how these triples may be related to natural numbers and made ordinal using Cantor's pairing function. A simple technique does not produce triples in size order but it does follow Cantor's function and is helped by the fact the $F(n,k)$ produces no trivial triples or the doubles and even-square multiples that Euclid's formula does.

If we increment $n$ and $k$ in specific patterns, we get

$(1,1),\\ (1,2),\space (2,1),\\ (1,3),\space (2,2),\space (3,1),\\ (1,4),\space (2,3),\space (3,2),\space (4,1)$

Note that $F(2,3)=(27,36,45)$ and others are non-primitive but I don't know what to do about that. Whether that is addressed or not, perhaps you can find the "products" of all these, and see what order $(n,k)$ can be arranged to selected for ascending size. Here are a few that I believe are arranged in "product" order.

$$(3,4,5)\quad (5,12,13)\quad (15,8,17)\quad (7,24,25)\quad (21,20,29)\\ (35,12,37)\quad (9,40,41)\quad (11,60,61)\quad (63,16,65)\quad (45,28,53)$$

Aside: I have proven (not here) that the formula generates all primitives by assuming some increment added to or subtracted from the $k$ components. Expansion shows that any other increment results in non-integer values for B and C.

poetasis
  • 6,338
  • 2
    Thanks for this! I’m writing up two papers right now: (1) the new descent formula I’ve found to traverse the PPTs without the need for sign manipulations, and (2) a survey of PPT enumeration systems. This will definitely help with the second one. – Kieren MacMillan Jul 19 '21 at 00:05
  • 2
    @Kieren MacMillan I once submitted a paper about my formula to JAMS but they rejected it. If you can get it “out there”, I would love it because I think it would somehow benefit the community who has not heard of it except for places like this. If you care, my email is [email protected] – poetasis Jul 19 '21 at 01:12
  • @Kieren MacMillan I think my rejected paper contained “too much” running to $15$ pages even with (or because of) my squeezing. I plan to rewrite one just on the subject of $$\text {Finding Triples for Any Legal B-A Value}$$. It took me a year or more to figure out but I’ve seen nothing like it anywhere so I think it could interest somebody. – poetasis Jul 19 '21 at 01:27
  • Up to permutation, $B$ and $A$ are given by $m^2-n^2$ and $2mn$, with $\gcd(m,n)=1$. Hence $B-A = m^2-2mn-n^2 = (m-n)^2-2n^2$. So the “legal” values of $B-A$ is exactly the set of odd positive integers that can be written in that form. Once you find $m$ and $n$, generating the triple is immediate. – Kieren MacMillan Jul 22 '21 at 13:27
  • 1
    @Kieren MacMillan The difference $B-A\in\mathbb{N}$ if we count non-primitives. If we count only primitives, $B-A$ can be any prime number $(p)$ where $p\equiv\pm1\mod 8$ with (p) raised to any non-negative integer power $n$. Under $100$, $B-A\in {1,7, 17, 23, 31, 41, 47, 49, 71, 73, 79, 89, 97}$. There are an infinite number off each and I have found how to generate them all. – poetasis Jul 22 '21 at 15:46
  • Yes, we’re saying the same thing. :) – Kieren MacMillan Jul 22 '21 at 15:58
  • @Kieren MacMillan I listed the "values" because I disagreed with what I perceived to be your statement $B-A\in{1,3,5,\cdots}$ – poetasis Jul 22 '21 at 20:01
  • The odd primes of the form $a^2-2b^2$ are ${7, 17, 23, 31, 41, 47, 71, 73, 79, 89, 97, \dots}$. Put another way, your perception of my statement wasn’t entirely correct. – Kieren MacMillan Jul 22 '21 at 20:06
  • @Kieren MacMillan The “set” must include $p^0=1.$ Your $|3^2-2\cdot 4^2|= 23$ does not show $4-3=1$ or, for example, $21-20=1.\quad $ I would like to continue this via email [email protected] where I can show you my technique(s) without cluttering this thread. – poetasis Jul 22 '21 at 20:31
1

Concerning the so-called sign issue with the ternary tree:

The Wikipedia essay cited elsewhere on this page gives the three matrices $$A=\pmatrix{1&-2&2\cr2&-1&2\cr2&-2&3\cr},\qquad B=\pmatrix{1&2&2\cr2&1&2\cr2&2&3\cr},\qquad C=\pmatrix{-1&2&2\cr-2&1&2\cr-2&2&3\cr}$$ with the properties that 1) if $v$ is a (positive) primitive pythagorean triple then so are $Av$, $Bv$, and $Cv$, 2) every primitive pythagorean triple can be obtained from $v=(3,4,5)$ in exactly one way by multiplying by a (finite) sequence of matrices, each matrix in the sequence being $A$ or $B$ or $C$.

We calculate the inverses, $$A^{-1}=\pmatrix{1&2&-2\cr-2&-1&2\cr-2&-2&3\cr},\qquad B^{-1}=\pmatrix{1&2&-2\cr2&1&-2\cr-2&-2&3\cr},\qquad C^{-1}=\pmatrix{-1&-2&2\cr2&1&-2\cr-2&-2&3\cr}$$ It follows that given any (positive) primitive pythagorean triple $w$, exactly one of the three vectors $A^{-1}w,B^{-1}w,C^{-1}w$ is a positive pythagorean triple.

For example, for $w=(165,52,173)$, we get $A^{-1}w=(-77,-36,85)$, $B^{-1}w=(-77,36,85)$, and $C^{-1}w=(77,36,85)$, so $C^{-1}w$ is the direct ancestor of $w$ on the tree.

Gerry Myerson
  • 179,216
  • Yes, this is exactly the problem I’m talking about: given an arbitrary PPT, one can’t apply the same single transformation every time and obtain the ancestor with three positive values — you need to possibly try all three (as you did here), or know in advance which vector was used originally. – Kieren MacMillan Jul 18 '21 at 03:40
  • 1
    @KierenMacMillan there is a “single transformation” you are applying, it’s just not a linear transformation but a function that involves things like absolute values (or a formula expressed in piecewise notation). – Dan Romik Jul 18 '21 at 22:31
  • @DanRomik: That’s semantics, at least for my purposes. Fortunately, just yesterday I finally found a formula — a single formula — that allows me to descend from any arbitrary Pythagorean triple to $(3,4,5)$ without the need for sign manipulation at any stage. – Kieren MacMillan Jul 18 '21 at 23:40