login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A307620
Integers x such that [f(0), f(f(0)), ..., f(...f(0)...)] is a permutation of [0, 1, ..., k-1], where k is the number of digits in x and f(a) denotes the 0-based index of the first occurrence of the substring a in x.
0
0, 10, 120, 201, 1230, 1302, 2031, 2310, 3012, 3201, 12340, 12403, 13042, 13420, 14023, 14302, 20341, 20413, 23140, 23401, 24103, 24310, 30142, 30421, 32041, 32410, 34012, 34120, 40123, 40312, 42013, 42301, 43021, 43102
OFFSET
1,2
COMMENTS
Numbers with 21 digits cannot fit every number from 0 to 20 as strings. Hence this sequence cannot have any numbers with 21 digits or more, making it finite.
1918171615141312110 is the largest number in this sequence (see examples).
EXAMPLE
Consider x = 40312. f(0) = 1, f(1) = 3, f(3) = 2, f(2) = 4, f(4) = 0 and so we have visited every index of x.
Consider the largest number in this sequence, x = 1918171615141312110. f(0) = 18, f(18) = 2, f(2) = 15, f(15) = 8, f(8) = 3, f(3) = 13, f(13) = 12, f(12) = 14, f(14) = 10, f(10) = 17, f(17) = 4, f(4) = 11, f(11) = 16, f(16) = 6, f(6) = 7, f(7) = 5, f(5) = 9, f(9) = 1, f(1) = 0 and so we have visited every index of x.
MATHEMATICA
{{0}}~Join~Array[Block[{k = #, r}, r = Range[0, k]; FromDigits /@ Select[DeleteCases[Permutations[r, {k + 1}], _?(First@ # == 0 &)], With[{w = #}, Union@ Rest@ Nest[Append[#, Position[w, #[[-1]]][[1, 1]] - 1] &, {0}, Length@ w] == r] &]] &, 4] // Flatten (* Michael De Vlieger, Apr 21 2019 *)
CROSSREFS
Sequence in context: A373711 A069498 A226767 * A300522 A252874 A182605
KEYWORD
nonn,fini,base
AUTHOR
Dmitry Kamenetsky, Apr 18 2019
STATUS
approved