%I #16 Feb 16 2022 07:39:18
%S 1,1,1,1,1,2,1,2,5,1,5,13,2,5,29,1,13,34,1,34,89,2,29,169,5,13,194,1,
%T 89,233,5,29,433,1,233,610,2,169,985,13,34,1325,1,610,1597,5,194,2897,
%U 1,1597,4181,2,985,5741,5,433,6466,13,194,7561,34,89,9077,1,4181,10946,29,169,14701
%N Array of Markov triples (x,y,z) sorted by z, read by rows.
%C The positive integers x, y, z satisfy the Diophantine equation x^2 + y^2 + z^2 = 3*x*y*z, 1 <= x <= y <= z.
%D Steven R. Finch, Mathematical Constants, Cambridge University Press, 2003, Section 2.31.3 Markov-Hurwitz Equation, p. 200.
%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/MarkovNumber.html">Markov Number</a>.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Markov_number">Markov number</a>.
%e The array of Markov triples begins:
%e (1, 1, 1),
%e (1, 1, 2),
%e (1, 2, 5),
%e (1, 5, 13),
%e (2, 5, 29),
%e (1, 13, 34),
%e ...
%t triples = 30; depth0 = 10 (* adjust depth according to message after first run *) ; Clear[zz, fx, fy]; fx[1] = fy[1] = fx[2] = fy[2] = fx[5] = 1;
%t fy[5] = 2; zz[n_] := zz[n] = Module[{f, x, y, z}, f[] = {1, 2, 5}; f[ud___, u(*up*)] := f[ud, u] = Module[{g = f[ud]}, x = g[[1]]; y = g[[3]]; z = 3*g[[1]]*g[[3]] - g[[2]]; fx[z] = x; fy[z] = y; {x, y, z}]; f[ud___, d(*down*)] := f[ud, d] = Module[{g = f[ud]}, x = g[[2]]; y = g[[3]]; z = 3*g[[2]]*g[[3]] - g[[1]]; fx[z] = x; fy[z] = y; {x, y, z}]; f @@@ Tuples[{u, d}, n] // Flatten // Union // PadRight[#, triples]&]; zz[n = depth0]; zz[n++]; While[zz[n] != zz[n - 1], n++]; Print["depth = n = ", n]; xyz = {fx[#], fy[#], #} & /@ zz[n]; Flatten[xyz]
%o (PARI) N=5000;
%o for(k=1, N, for(j=1, k, for(i=1, j, if(i*j>k, break); if(i^2+j^2+k^2==3*i*j*k, print1(i, ", ", j, ", ", k, ", "))))); \\ _Seiichi Manyama_, Feb 16 2022
%Y Cf. A002559 (main entry for this sequence), A178444, A256395, A261613, A351372.
%K nonn,tabf
%O 1,6
%A _Jean-François Alcover_, Aug 30 2017