%I #16 Feb 23 2018 09:23:29
%S 1,2,3,4,5,6,8,7,12,10,9,14,16,11,15,18,20,21,24,22,25,27,26,30,33,35,
%T 28,32,13,36,34,42,40,39,48,38,56,44,45,51,49,52,54,46,63,60,57,64,17,
%U 70,68,77,50,66,55,65,72,58,80,69,81,62,88,75,78,84,76
%N Lexicographically earliest sequence of distinct positive terms such that, for any n > 1, if prime(k) is the greatest prime factor of a(n) then k divides a(n+1) (where prime(k) denotes the k-th prime).
%C In other words, for any n > 1, A061395(a(n)) divides a(n+1).
%C See also A299441 for the variant involving least prime factors.
%H Rémy Sigrist, <a href="/A299442/b299442.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A299442/a299442.gp.txt">PARI program for A299442</a>
%H Rémy Sigrist, <a href="/A299442/a299442.png">Colored scatterplot of the first 100000 terms</a> (where the color is function of A006530(a(n-1)))
%e The first terms, alongside A061395(a(n)), are:
%e n a(n) A061395(a(n))
%e -- ---- -------------
%e 1 1 0
%e 2 2 1
%e 3 3 2
%e 4 4 1
%e 5 5 3
%e 6 6 2
%e 7 8 1
%e 8 7 4
%e 9 12 2
%e 10 10 3
%e 11 9 2
%e 12 14 4
%e 13 16 1
%e 14 11 5
%e 15 15 3
%e 16 18 2
%e 17 20 3
%e 18 21 4
%e 19 24 2
%e 20 22 5
%p N:= 1000: # to get terms before the first term > N
%p with(numtheory):
%p V:= Vector(N):
%p A[1]:= 1: A[2]:= 2: V[1]:= 1: V[2]:= 1:
%p found:= true:
%p for n from 2 while found do
%p found:= false;
%p k:= pi(max(factorset(A[n])));
%p for v from k to N by k do
%p if V[v] = 0 then
%p V[v]:= 1;
%p A[n+1]:= v;
%p found:= true;
%p break
%p fi
%p od
%p od:
%p seq(A[i],i=1..n-1); # _Robert Israel_, Feb 18 2018
%t max = 100; Clear[a, V]; a[_] = 0; V[_] = 0; a[1] = 1; a[2] = 2; V[1] = 1; V[2] = 1; found = True; For[n = 2, found, n++, found = False; k = PrimePi[ FactorInteger[a[n]][[-1, 1]]]; For[v = k, v <= max, v += k, If[V[v] == 0, V[v] = 1; a[n+1] = v; found = True; Break[]]]]; DeleteCases[ Array[a, max], 0] (* _Jean-François Alcover_, Feb 23 2018, after _Robert Israel_ *)
%o (PARI) See Links section.
%Y Cf. A006530, A061395, A299441.
%K nonn
%O 1,2
%A _Rémy Sigrist_, Feb 10 2018