OFFSET
1,1
COMMENTS
If {x,y} are used as the generators of primitive Pythagorean triples (a,b,c) where a=y^2-x^2, b=2x*y and c=x^2+y^2, then the above sequence enumerates all PPT's as a 1-to-1 mapping into the integers.
LINKS
Frank M Jackson, Table of n, a(n) for n = 1..57
Lance Fortnow, Counting the Rationals Quickly, Computational Complexity Weblog, Monday, March 01, 2004.
Yoram Sagher, Counting the rationals, Amer. Math. Monthly, 96 (1989), p. 823. Math. Rev. 90i:04001.
EXAMPLE
. -- ------------------------------------------------------------
. 1: 1,1
. 2: 1,2 2,1
. 3: 1,3 2,3 3,1
. 4: 1,4 3,2 3,4 4,1
. 5: 1,5 2,5 3,5 4,5 5,1
. 6: 1,6 4,3 5,2 5,3 5,6 6,1
. 7: 1,7 2,7 3,7 4,7 5,7 6,7 7,1
. 8: 1,8 5,4 3,8 7,2 5,8 7,4 7,8 8,1
. 9: 1,9 2,9 7,3 4,9 5,9 8,3 7,9 8,9 9,1
. 10: 1,10 6,5 3,10 7,5 9,2 8,5 7,10 9,5 9,10 10,1
. 11: 1,11 2,11 3,11 4,11 5,11 6,11 7,11 8,11 9,11 10,11 11,1
. 12: 1,12 7,6 9,4 10,3 5,12 11,2 7,12 11,3 11,4 11,6 11,12 12,1 .
a(4)=9, as the 4th PPT is generated from the 9th term of the triangular array at index (3,4). This gives (x,y) as (3,4) and it generates the PPT (7,24,25). Conversely the PPT (7,24,25) gives (x,y) = (sqrt((25-7)/2), sqrt((25+7)/2)=(3,4). It is the 9th term of the triangular array and the 4th term of the enumerating sequence.
MATHEMATICA
ratmap[p_, q_] := (q(q-1)/2+p); mm=20; lst={}; Do[If[OddQ[m+n]&&GCD[m, n]==1, AppendTo[lst, n/m]], {m, 1, mm}, {n, 1, m}]; Sort@Table[ratmap[Numerator[lst[[k]]], Denominator[lst[[k]]]], {k, 1, Length[lst]}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Frank M Jackson, Jun 13 2014
STATUS
approved