OFFSET
1,2
COMMENTS
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.
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.
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).
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.
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.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Annotated plot of the first 81 terms, points colored per m mod 10.
EXAMPLE
The sequence repeats 8 phases generally related to m mod 90 by decade.
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.
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}.
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.
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.
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.
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.
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.
Phase 8 is the last phase, ending with a(81): 73 -> 1: 81 -> 9: 89, etc., thus {81, 89, 88, ..., 83, 82}.
Therefore we have generated a(1)..a(81) and may express a(n) for n > 81 via a(81k + j) = 90k + a(j).
MATHEMATICA
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]]
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Michael De Vlieger, Oct 15 2020
STATUS
approved