%I #9 Dec 28 2020 17:50:57
%S 1,11,2,12,3,13,4,14,5,15,6,16,7,17,8,18,9,19,21,23,25,27,29,22,24,26,
%T 28,31,34,37,41,35,38,32,45,39,33,36,49,44,48,43,47,42,46,51,56,52,57,
%U 53,58,54,59,55,61,67,64,71,68,65,62,78,66,63,69,76,74,72
%N a(1) = 1, a(n) is the least m not already in a(n) such that m mod 10 = decimal digital root of a(n - 1).
%C Define d(n) as the decimal digital root of n, which is equivalent to n = r (mod 9), replacing the residue r = 0 with 9 in all cases of nonzero n.
%C m = 0 (mod 10) is prohibited as a consequence, therefore a(n) is not a permutation of the natural numbers, but contains all positive nonzero m indivisible by 10.
%C We may write the function d(n) instead as "->" for brevity, separating the least novel m from r with a colon. Therefore, a(2) is derived from a(1) = 1 thus: 1 -> 1: 11 (see Example).
%C Having found a(1)..a(81), we may generate a(81k + j) = 90k + a(j), since a(82) = 91 -> 1 and the next interval of 90 unused numbers are congruent to 0 < m < 90 (mod 9). By induction we see the sequence is infinite and contains all nonzero m (mod 90) that are indivisible by 10.
%C Graphing very many terms results in a line-like plot with slope 10/9. Compare the behavior and plot of this sequence to A248025, which applies d(a(n-1)) to the first digit of m rather than last.
%H Michael De Vlieger, <a href="/A338191/b338191.txt">Table of n, a(n) for n = 1..10000</a>
%H Michael De Vlieger, <a href="/A338191/a338191.png">Annotated plot of the first 81 terms</a>, points colored per m mod 10.
%e The sequence repeats 8 phases generally related to m mod 90 by decade.
%e Phase 1 containing a(n) with 1 <= n <= 18 and involving 1 <= m mod 90 <= 19, begins as follows: 1 -> 1: 11 -> 2: 2 -> 2: 12 -> 3: 3, etc., therefore we have {1, 11, 2, 12, 3, 13, ..., 19}, wherein we have each r twice in succession but incrementing r afterward.
%e Phase 2 containing a(n) with 19 <= n <= 27 and involving m mod 90 in the 20s, results from 19 -> 2, the third request for r = 2, so a(19) = 21. 21 -> 3: 23 -> 5: 25, etc. thus {21, 23, 25, 27, 29}, then 29 -> 2: 22 -> 4: 24, etc. thus {22, 24, 26, 28}.
%e Phase 3 contains a(n) with 28 <= n <= 36: 28 -> 1: 31 -> 4: 34 -> 7: 37 -> 1: 41 -> 5: 35 -> 8: 38 -> 2: 32 -> 5: 45 -> 9: 39 -> 3: 33 -> 6: 36. This exhausts m mod 90 in the thirties. Generally, phases 3 | p involve m mod 90 = 10*p + c*(p + 1), with 0 <= c <= 1.
%e Phase 4 contains a(n) with 37 <= n <= 45 and begins with {41, 45} already used. 36 -> 9: 49 -> 4: 44 -> 8: 48 -> 3: 43 -> 7: 47 -> 2: 42 -> 6: 46. This exhausts m mod 90 in the forties.
%e Phase 5 contains a(n) with 46 <= n <= 54: 46 -> 1: 51 -> 6: 56 -> 2: 52, etc., thus {51, 56, 52, 57, 53, 58, 54, 59, 55}, exhausting m mod 90 in the fifties.
%e Phase 6 contains a(n) with 55 <= n <= 65: 55 -> 1: 61 -> 7: 67 -> 4: 64 -> 1: 71 -> 8: 68 -> 5: 65 -> 2: 62 -> 8: 78 -> 6: 66 -> 3: 63 -> 9: 69. We have exhausted m mod 90 in the sixties.
%e Phase 7 contains a(n) with 66 <= n <= 72, begining with {71, 78} already used. 69 -> 6: 76, etc., thus {76, 74, 72, 79, 77, 75, 73}, exhausting m mod 90 in the seventies.
%e Phase 8 is the last phase, ending with a(81): 73 -> 1: 81 -> 9: 89, etc., thus {81, 89, 88, ..., 83, 82}.
%e Therefore we have generated a(1)..a(81) and may express a(n) for n > 81 via a(81k + j) = 90k + a(j).
%t With[{s = Nest[Append[#, Block[{k = 1, r = Mod[#[[-1]], 9] + 9 Boole[Mod[#[[-1]], 9] == 0]}, While[Nand[FreeQ[#, k], Mod[k, 10] == r], k++]; k]] &, {1}, 9^2]}, Array[If[#2 == 0, 90 #1 - 8, 90 #1 + s[[#2]] ] & @@ QuotientRemainder[#, 81] &, 10^3]]
%Y Cf. A248025.
%K nonn,base,easy
%O 1,2
%A _Michael De Vlieger_, Oct 15 2020