A341936 a(0) = 0; for n > 0, a(n) is the smallest positive integer not yet in the sequence that can be created by adding 1, 0, or -1, for digits > 0, to every digit in a(n-1).
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 28, 27, 26, 25, 24, 23, 22, 21, 20, 30, 31, 32, 33, 34, 35, 36, 37, 38, 29, 39, 48, 47, 46, 45, 44, 43, 42, 41, 40, 50, 51, 52, 53, 54, 55, 56, 57, 58, 49, 59, 68, 67, 66, 65, 64, 63, 62, 61, 60, 70, 71, 72, 73
Offset: 0
Examples
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.
Links
- Scott R. Shannon, Scatterplot of the first 1 million terms.
- Scott R. Shannon, Line graph of the first 1 million terms.
Programs
-
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 *)
Comments