%I #13 Dec 01 2018 04:54:12
%S 4,12,20,8,24,48,28,80,120,36,56,72,12,40,88,60,208,304,84,168,224,44,
%T 176,336,180,456,696,220,288,360,52,140,252,120,252,396,136,132,156,
%U 16,60,140,104,396,572,152,340,460,96,468,884,464,1140,1748,560,700
%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 second 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 even.
%H Rémy Sigrist, <a href="/A321769/b321769.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 Empirically:
%F - T(n, 1) = A046092(n),
%F - T(n, (3^(n-1) + 1)/2) = A046729(n),
%F - T(n, 3^(n-1)) = 4 * n.
%e The first rows are:
%e 4
%e 12, 20, 8
%e 24, 48, 28, 80, 120, 36, 56, 72, 12
%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[2, 1])
%Y See A321768 and A321770 for the other components.
%Y Cf. A046092, A046729.
%K nonn,tabf
%O 1,1
%A _Rémy Sigrist_, Nov 18 2018