This enumeration of all primitive Pythagorean triples (PPTs) generates exactly one PPT from every natural number, thus creating a comprehensive ordered list of all PPTs, indexed by the natural numbers. This is done by first taking the function

, which generates a list consisting of only those natural numbers that in turn will generate compliant Calkin–Wilf (C–W) pairs of the form

, subject to the conditions that

and

be relatively prime, have opposite parity and that

. These pairs are then used to generate PPTs of the form

, thus giving a one-to-one mapping between the set of all natural numbers and the set of all PPTs.

The sliders control how many PPTs are calculated, and in graph mode how much to zoom in on those close to the origin. Use the "mode" toggle bar to select between graphing the PPTs or the C–W pairs, or generating a simple list or a commented table of PPTs.

Snapshot 1: the scatter plot graph of the enumerated PPTs as given on the

plane, where

is the odd leg and

the even leg of the triangle represented by the PPT, zoomed in to show only

of the largest value

Snapshot 2: a simple list of the PPTs generated by the enumeration

Snapshot 3: the scatter plot graph of the compliant C–W pairs (which can also be thought of as reduced fractions) used to generate the PPTs, shown in the

plane. In this context, compliant means that

and

satisfy three criteria:

(1)

and

are relatively prime

(2)

and

are not both odd

(3)

These are the conditions needed to give only PPTs.

Snapshot 4: a simple list of the compliant C–W pairs used to generate the PPTs

Snapshot 5: explanatory table giving all steps of the process: natural numbers, compliant natural numbers, compliant C–W pairs, and PPTs generated by the enumeration algorithm

Most generating algorithms for PPTs are based on a ternary tree (see references for examples), while the present algorithm, suggested in [1, Section 8], by Kevin Ryde, and similar to the procedure sketched out in section "Enumeration of Primitive Pythagorean Triples" of [1], relies on a binary tree, in this case the C–W tree of reduced rational numbers. Therefore condition (1) is automatically guaranteed for any index. We found that condition (3) was guaranteed by eliminating all odd index numbers (whose binary form ends with 1), and (2) by omitting 4 and every third remaining index thereafter, leaving

as allowed indices. The function

gives precisely that set, providing only the natural numbers that generate compliant C–W pairs as needed to generate only PPTs. It is worth noting that removing these restrictions does not generate all non-primitive Pythagorean triples.

[4] A. Hall, "Genealogy of Pythagorean Triads,"

*The Mathematical Gazette*,

**54**(390), 1970, pp. 377–379.

doi:10.2307/3613860.