OFFSET
1,2
COMMENTS
It is unknown whether every natural number eventually appears in the sequence, but some have notably late entry points. For instance, a(n) = 28 for the first time (possibly only time) at n = 582. 280 first appears at n = 16175. 508 and 624 are the only values less than 1000 that do not appear in the first 50000 terms. After n = 4, the first time a(n) = n is at term 766. Thereafter, a(n) = n at 1952, 4682, 6367, 6368, and not again within the first 50000 terms.
LINKS
Max Tohline, Table of n, a(n) for n = 1..20000
MATHEMATICA
gf[n_] := n/FactorInteger[n][[1, 1]]; s = {1, 2}; Do[a = s[[-1]] + If[PrimeQ[s[[-1]]], 1, m = If[(p = Position[s, _?(# == (k = gf[s[[-1]]]) &)]) == {}, -k, Length[s] - p[[-1, 1]]]]; AppendTo[s, a], {100}]; s (* Amiram Eldar, Sep 06 2019 *)
PROG
(PARI) { a = vector(69); for (n=1, #a, if (n==1, a[n] = 1, n==2, a[n] = 2, isprime(a[n-1]), a[n] = a[n-1]+1, d = divisors(a[n-1]); k = d[#d-1]; a[n] = a[n-1]-k; forstep (m=n-2, 1, -1, if (a[m]==k, a[n] = a[n-1] + n-1 - m; break))); print1 (a[n] ", ")) } \\ Rémy Sigrist, Sep 06 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Max Tohline, Aug 29 2019
STATUS
approved