%I #9 Apr 10 2026 08:17:33
%S 1,2,3,4,5,6,7,8,11,9,13,10,17,12,19,14,15,16,21,20,23,18,29,22,27,25,
%T 31,24,35,26,33,28,37,30,41,32,39,34,43,36,47,38,51,44,53,40,59,42,55,
%U 46,57,49,61,45,67,48,65,54,71,50,69,52,73,56,79,58,77
%N Lexicographically earliest sequence of distinct positive integers such that the prime tower factorizations of two consecutive terms have no common prime number.
%C The prime tower factorization of a number is defined in A182318.
%C This sequence is a permutation of the positive integers with inverse A394859:
%C - we can always extend the sequence with some prime number larger than all prior terms,
%C - for any prime number p, the first term >= p is necessarily p,
%C - all prime numbers appear in the sequence, in natural order,
%C - each time we hit a prime number p, the least missing composite number c < p if any must follow immediately, so eventually every composite number will appear in the sequence.
%H Rémy Sigrist, <a href="/A394857/b394857.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A394857/a394857.gp.txt">PARI program</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F gcd(A336965(a(n)), A336965(a(n+1))) = 1.
%e The first terms are:
%e n a(n) a(n)-th row of A336964
%e -- ---- ----------------------
%e 1 1 [1]
%e 2 2 [2]
%e 3 3 [3]
%e 4 4 [2]
%e 5 5 [5]
%e 6 6 [2, 3]
%e 7 7 [7]
%e 8 8 [2, 3]
%e 9 11 [11]
%e 10 9 [2, 3]
%e 11 13 [13]
%e 12 10 [2, 5]
%e 13 17 [17]
%e 14 12 [2, 3]
%e 15 19 [19]
%e 16 14 [2, 7]
%e 17 15 [3, 5]
%e 18 16 [2]
%e 19 21 [3, 7]
%e 20 20 [2, 5]
%o (PARI) \\ See Links section.
%Y Cf. A182318, A336964, A336965, A394855, A394858, A394859 (inverse).
%K nonn
%O 1,2
%A _Rémy Sigrist_, Apr 04 2026