OFFSET
1,1
COMMENTS
Take two positive integers, x > y. As shown in the referenced faux art, you can form a vector using the integers as the coordinates, and repeat that vector and its equal-length normal so that you get exactly to the x-axis. Now you can mirror the pattern: take the same number of normal vectors but in the opposite direction. You get an isosceles triangle and the equal sides represent a Pythagorean triple.
Let s = gcd(x,y). This is the scaling factor -- you divide x and y by it and get coprime x and y. The symmetry axis goes from (0,0) to (xx,xy). The first normal goes from (xx,xy) to (xx+yy,0). The second normal goes from (xx,xy) to (xx-yy,xy+xy). So x^2+y^2 is the hypotenuse of the triangle with catheti x^2-y^2 and 2xy. Scale these with s and you get the triple corresponding to the parameters. In the examples the hypotenuse will be called P(x,y).
LINKS
Juhani Heino, Faux art showing the motivation of this.
Wikipedia, Pythagorean Triple.
EXAMPLE
Triangle with each row r going from P(r+1,1) to P(r+1,r):
P(2,1)=5;
P(3,1)=10, P(3,2)=13;
P(4,1)=17, P(4,2)=2*P(2,1)=10, P(4,3)=25;
P(5,1)=26, P(5,2)=29, P(5,3)=34, P(5,4)=41;
P(6,1)=37, P(6,2)=2*P(3,1)=20, P(6,3)=3*P(2,1)=15, P(6,4)=2*P(3,2)=26, P(6,5)=61;
PROG
(PARI)
p(x, y) = x^2 + y^2
out=""
for (row = 1, 15, for (col = 1, row, s=gcd(row+1, col); out = Str(out, s * p((row+1)/s, col/s), ", ") ))
print(out);
CROSSREFS
KEYWORD
AUTHOR
Juhani Heino, Oct 16 2016
STATUS
approved