A297062 Starting with a(1) = 0, a(2) = 1, a(n) = smallest nonnegative integer that shares all digits with previous terms. No repeated digits are allowed.
0, 1, 10, 102, 120, 201, 210, 1023, 1032, 1203, 1230, 1302, 1320, 2013, 2031, 2103, 2130, 2301, 2310, 3012, 3021, 3102, 3120, 3201, 3210, 10234, 10243, 10324, 10342, 10423, 10432, 12034, 12043, 12304, 12340, 12403, 12430, 13024, 13042, 13204, 13240, 13402, 13420, 14023
Offset: 1
Crossrefs
Cf. A199168.
Programs
-
Mathematica
Nest[Function[a, Append[a, Block[{k = Last@ a + 1}, While[Nand[Union@ Tally[#][[All, -1]] == {1}, Complement[Union@ Flatten@ Map[IntegerDigits, a], #] == {}] &@ IntegerDigits@ k, k++]; k]]], {0, 1}, 42] (* Michael De Vlieger, Dec 24 2017 *)
Comments