%I #13 Dec 01 2018 04:54:16
%S 5,13,29,17,25,73,53,89,169,85,65,97,37,41,137,109,233,425,205,193,
%T 305,125,185,505,349,505,985,509,337,481,173,149,373,241,277,565,305,
%U 157,205,65,61,221,185,445,797,377,389,629,265,493,1325,905,1261,2477
%N Consider the tree of triples P(n, k) with n > 0 and 0 < k <= 3^(n-1), such that P(1, 1) = [3; 4; 5] and each triple t on some row branches to the triples A*t, B*t, C*t on the next row (with A = [1, -2, 2; 2, -1, 2; 2, -2, 3], B = [1, 2, 2; 2, 1, 2; 2, 2, 3] and C = [-1, 2, 2; -2, 1, 2; -2, 2, 3]); T(n, k) is the third component of P(n, k).
%C The tree P runs uniquely through every primitive Pythagorean triple.
%C See A321768 for additional comments about P.
%C All terms are odd.
%H Rémy Sigrist, <a href="/A321770/b321770.txt">Rows n = 1..9, flattened</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Tree_of_primitive_Pythagorean_triples">Tree of primitive Pythagorean triples</a>
%H <a href="/index/Ps#PyTrip">Index entries related to Pythagorean Triples</a>
%F a(n)^2 = A321768(n)^2 + A321769(n)^2.
%F Empirically:
%F - T(n, 1) = A001844(n),
%F - T(n, (3^(n-1) + 1)/2) = A001653(n+1),
%F - T(n, 3^(n-1)) = A053755(n).
%e The first rows are:
%e 5
%e 13, 29, 17
%e 25, 73, 53, 89, 169, 85, 65, 97, 37
%o (PARI) M = [[1, -2, 2; 2, -1, 2; 2, -2, 3], [1, 2, 2; 2, 1, 2; 2, 2, 3], [-1, 2, 2; -2, 1, 2; -2, 2, 3]];
%o T(n, k) = my (t=[3; 4; 5], d=digits(3^(n-1)+k-1, 3)); for (i=2, #d, t = M[d[i]+1] * t); return (t[3, 1])
%Y See A321768 and A321769 for the other components.
%Y Cf. A001653, A001844, A053755.
%K nonn,tabf
%O 1,1
%A _Rémy Sigrist_, Nov 18 2018