

A308387


Lexicographically earliest selfdescribing sequence of distinct terms such that, when we read digit after digit from the left to the right, the nth digit of the sequence is duplicated at the digitposition a(n). After all duplications are done, the resulting sequence is itself.


3



2, 20, 6, 10, 8, 11, 60, 5, 13, 4, 3, 19, 52, 16, 24, 14, 9, 27, 12, 1, 17, 36, 28, 15, 21, 43, 18, 23, 34, 61, 37, 25, 30, 68, 100, 22, 31, 7, 32, 56, 47, 33, 26, 35, 39, 38, 41, 44, 48, 73, 59, 42, 49, 130, 64, 40, 53, 62, 51, 46, 45, 58, 101, 55, 70, 57, 86
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


LINKS

Lars Blomberg, Table of n, a(n) for n = 1..7000
Eric Angelini, Two selfdescribing sequences.


EXAMPLE

The sequence starts with 2,20,6,10,8,11,60,...
The 1st digit (2) is duplicated at position 2 in the sequence, as a(1) = 2 (this new 2 is visible in 20);
The 2nd digit (2) is duplicated at position 20 in the sequence, as a(2) = 20 (this new 2 is visible in 52);
The 3rd digit (0) is duplicated at position 6 in the sequence, as a(3) = 6 (this new 0 is visible in 10);
The 4th digit (6) is duplicated at position 10 in the sequence, as a(4) = 10 (this new 6 is visible in 60);
The 5th digit (1) is duplicated at position 8 in the sequence, as a(5) = 8 (this new 1 is visible in 11, first digit); etc.
The duplication rule is: a(n) cannot command the duplication of one of its own digits  else the lexicographically first sequence would simply be 1, 2, 3, 4, 5, ... where every digit is "duplicated" on itself. We see with this counterexample that the sequence cannot start with a(1) = 1 as this digit 1 would be duplicated on itself; but a(1) = 2 is ok as there is an available integer a(2) that starts with the duplicated 2 (here, 20, as 20 is the smallest unused term starting with 2); etc.
Why is a(3) = 6?
We must remember that a(3) = k means that the 3rd digit of the sequence is duplicated at digitposition k (counting digit after digit from the beginning); as the 3rd digit of the sequence is 0 (the 0 visible in 20), we cannot have a(3) = 1, which would be a contradiction (the 1st digit is a 2 and not a 0): so this start is impossible: 2,20,1,...
a(3) = 2 is impossible too, as there is already a term 2 in the sequence;
a(3) = 3 is impossible, as this would duplicate 0 on itself (forbidden);
a(3) = 4 is impossible too, see: 2,20,4,... The 3rd digit, 0, cannot be duplicated in digitposition 4 as this position is already occupied by 4 itself!
a(3) = 5 is impossible too, because no term can have a leading 0, see: 2,20,5,0,... and the try 2,20,10,... is lexicographically worse then the solution coming now;
a(3) = 6 works indeed: 2,20,6,.0 (the dot is a free space, available for a digit that will stick to the 0); thus a(4) = 10, smallest available integer that produces no contradiction (this integer 10, being the 4th term of the sequence, commands the duplication of the 4th digit (6) at the digitposition 10 in the sequence; this is ok for the moment: 2,20,6,10,...6...
Etc.


CROSSREFS

Cf. A308386 (illustrates the same idea, but with letters instead of digits).
Sequence in context: A077341 A344545 A076495 * A058403 A083297 A343927
Adjacent sequences: A308384 A308385 A308386 * A308388 A308389 A308390


KEYWORD

base,nonn


AUTHOR

Eric Angelini, May 23 2019


STATUS

approved



