OFFSET
0,3
COMMENTS
Each individual digit in a(n-1) has either -1,0, or 1 added to it to find the next term. For example 23 can become 12,13,14,22,23,24,32,33,34. Of these options the lowest number not previously seen is then chosen for a(n). A 1 digit becomes 0,1 or 2, a zero digit becomes 0 or 1, while a 9 digit becomes 8,9 or 10 in the next term, e.g. 19 can become 8,9,10,18,19,110,28,29,210. Note that if a leading 1 becomes a 0 it is dropped, along with other leading 0's, for the next term.
The sequence is likely a permutation of the nonnegative integers. The lowest unused number after 1 million terms is 999897.
LINKS
Scott R. Shannon, Scatterplot of the first 1 million terms.
Scott R. Shannon, Line graph of the first 1 million terms.
EXAMPLE
a(1) = 1 as a(0) = 0 and the two numbers that can be created from 0 are 0 and 1, since 0 cannot have 1 subtracted. 0 has already occurred so 1 must be chosen.
a(20) = 28 as a(19) = 19 and the nine numbers that can be created from 19 are 8,9,10,18,19,110,28,29,210. The numbers 8,9,10,18,19 have already occurred and 28 is the smallest of the other four possibilities, so 28 is chosen.
a(29) = 30 as a(28) = 20 and the six numbers that can be created from 20 are 10,11,20,21,30,31. The numbers 10,11,20,21 have already occurred and 30 is the smallest of the other two possibilities, so 30 is chosen.
a(1870) = 995 as a(1869) = 1886 and of the 81 possible numbers that can be created from 1886, 995 is the smallest that has not previously occurred. This example shows that the terms can have a large drop in value if the leading digit can decrease by 1.
a(1875) = 8108 as a(1874) = 999 and of the 27 possible numbers that can be created from 999, 8108 is the smallest that has not previously occurred. This example shows that the terms can have a large increase in value if any of its 9 digits are forced to increase to 10.
MATHEMATICA
Nest[Block[{a = #, n = #[[-1]]}, Append[a, SelectFirst[Union@ Map[FromDigits@ DeleteCases[Flatten@ IntegerDigits[IntegerDigits[n] + #], _?(AnyTrue[#, # < 0 &] &)] &, Tuples[{-1, 0, 1}, IntegerLength[n]]], FreeQ[a, #] &]]] &, {0, 1}, 71] (* Michael De Vlieger, Feb 27 2021 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Feb 23 2021
STATUS
approved