%I #17 Oct 25 2018 13:01:59
%S 1,2,3,4,6,8,9,5,7,10,12,14,15,16,18,20,21,22,24,26,27,25,28,30,32,33,
%T 34,36,38,39,35,40,42,44,45,46,48,50,51,52,54,56,57,55,49,11,13,17,19,
%U 23,29,31,37,41,43,47,53,58,60,62,63,64,66,68,69,65,70
%N Lexicographically earliest sequence of distinct positive terms such that a(1) = 1, a(2) = 2, and for any n > 2, the least prime factor of a(n) does not exceed the prime next to the least prime factor of a(n-1).
%C More formally, for any n > 0, A055396(a(n+1)) <= A055396(a(n)) + 1.
%C This sequence is a variant of A320454.
%C This sequence is a permutation of the natural numbers, with inverse A320504; the reasoning to prove it is similar to that of A320454.
%C The prime numbers appear in ascending order as clusters in the sequence; the first prime clusters are:
%C - 2 terms: a(2) = 2, a(3) = 3,
%C - 2 terms: a(8) = 5, a(9) = 7,
%C - 12 terms: a(46) = 11, ..., a(57) = 53,
%C - 400 terms: a(2638) = 59, ..., a(3037) = 2861,
%C - 552398 terms: a(9149634) = 2879, ..., a(9702031) = 8207707.
%C The next prime cluster is expected to appear after the occurrence of the term 8207707^2.
%C The first known fixed points are: 1, 2, 3, 4, 10, 58, 84367, 2934331.
%H Rémy Sigrist, <a href="/A320503/b320503.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A320503/a320503.png">Scatterplot of the first 10000000 terms</a> (with prime terms highlighted)
%H Rémy Sigrist, <a href="/A320503/a320503.txt">C program for A320503</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e The first terms, alongside the least prime factor of a(n) and A055396(a(n)), are:
%e n a(n) lpf(a(n)) A055396(a(n))
%e -- ---- --------- -------------
%e 1 1 N/A 0
%e 2 2 2 1
%e 3 3 3 2
%e 4 4 2 1
%e 5 6 2 1
%e 6 8 2 1
%e 7 9 3 2
%e 8 5 5 3
%e 9 7 7 4
%e 10 10 2 1
%e 11 12 2 1
%e 12 14 2 1
%e 13 15 3 2
%e 14 16 2 1
%e 15 18 2 1
%t Nest[Append[#, Block[{k = 3, p}, While[Nand[Set[p, FactorInteger[k][[1, 1]]] <= NextPrime[#[[-1, -1]] ], FreeQ[#[[All, 1]], k ]], k++]; {k, p}]] &, {{1, 1}, {2, 2}}, 65][[All, 1]] (* _Michael De Vlieger_, Oct 17 2018 *)
%o (C) See Links section.
%Y Cf. A055396, A320454, A320504 (inverse).
%K nonn
%O 1,2
%A _Rémy Sigrist_, Oct 13 2018