%I #16 Mar 14 2021 20:37:24
%S 1,1,2,2,1,3,2,4,1,3,2,4,1,3,3,6,2,4,1,5,3,6,2,4,1,5,3,6,2,4,8,1,5,4,
%T 8,2,6,3,9,1,5,4,8,1,5,10,2,6,3,9,4,8,1,5,10,2,6,3,9,5,10,2,8,4,12,6,
%U 3,9,1,7,5,10,2,8,4,12,6,3,9,1,7
%N Lexicographically earliest longest simple path in the divisor graph of {1,...,n}. Irregular triangle read by rows.
%C A simple path in the divisor graph of {1,...,n} is a sequence of distinct numbers between 1 and n such that if k immediately follows m, then either k divides m or m divides k. For more information, references and links see A337125.
%e 1: [1],
%e 2: [1, 2],
%e 3: [2, 1, 3],
%e 4: [2, 4, 1, 3],
%e 5: [2, 4, 1, 3],
%e 6: [3, 6, 2, 4, 1, 5],
%e 7: [3, 6, 2, 4, 1, 5],
%e 8: [3, 6, 2, 4, 8, 1, 5],
%e 9: [4, 8, 2, 6, 3, 9, 1, 5],
%e 10: [4, 8, 1, 5, 10, 2, 6, 3, 9],
%e 11: [4, 8, 1, 5, 10, 2, 6, 3, 9],
%e 12: [5, 10, 2, 8, 4, 12, 6, 3, 9, 1, 7],
%e 13: [5, 10, 2, 8, 4, 12, 6, 3, 9, 1, 7],
%e 14: [5, 10, 1, 7, 14, 2, 8, 4, 12, 6, 3, 9],
%e 15: [6, 12, 4, 8, 1, 7, 14, 2, 10, 5, 15, 3, 9],
%e 16: [6, 12, 4, 8, 16, 1, 7, 14, 2, 10, 5, 15, 3, 9].
%p with(Iterator):
%p DivisorPath := proc(n, k) local c, p, w, isok;
%p isok := proc(A) local e, i, di; e := nops(A) - 1;
%p di := (n, k) -> evalb(irem(n, k) = 0 or irem(k, n) = 0):
%p for i from 1 to e while di(A[i], A[i+1]) do od;
%p return evalb(i = e + 1) end:
%p for c in Combination(n, k) do
%p for p in Permute([seq(j + 1, j in c)], k) do
%p w := convert(p, list);
%p if isok(w) then return w fi:
%p od od end:
%p A337125 := [1, 2, 3, 4, 4, 6, 6, 7, 8, 9, 9]:
%p for n from 1 to 9 do DivisorPath(n, A337125[n]) od;
%Y Cf. A337125 (row length), A339490.
%Y Cf. A339492, A339489, A339496.
%Y Cf. A340114 (a variant problem).
%K nonn,tabf
%O 1,3
%A _Peter Luschny_, Dec 29 2020
%E Signposting added to first comment by _Peter Munn_, Mar 12 2021