# [seqfan] The a(n)th digit of S is present in a(n)

Eric Angelini Eric.Angelini at kntv.be
Wed Nov 19 13:06:25 CET 2014

```Hello SeqFans,
... another self-ref'-like seq! [hope no jammed lines and no
mistakes]:

« The a(n)th digit of S is present in a(n) »

S is meant to be the lexico-first permutation of the integers > 0
showing this property:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,21,13,40,14,15,22,16,17,23,24,50,18,34,19,25,26,27,31,36,
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33 33 33 33 33 44 44 44 44 44 55 55 55 55
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67

Check:

- the 1st digit of S is "1", and this "1" is present in a(1)=1
- the 2nd digit of S is "2", and this "2" is present in a(2)=2
- the 3rd digit of S is "3", and this "3" is present in a(3)=3
- the 4th digit of S is "4", and this "4" is present in a(4)=4
...
- the 10th digit of S is "1", and this "1" is present in a(10)=10
- the 11th digit of S is "0", and this "0" is present in a(11)=20
- the 12th digit of S is "2", and this "2" is present in a(12)=12
- the 13th digit of S is "0", and this "0" is present in a(13)=30
- the 14th digit of S is "1", and this "1" is present in a(14)=11
- the 15th digit of S is "2", and this "2" is present in a(15)=21
- the 16th digit of S is "3", and this "3" is present in a(16)=13
...
- the 57th digit of S (the last digit of S in the example above)
is "6", and this "6" must be present in a(57)

The last sentence explains how S was built.

The "empty boxes" reserved for future integers of S are filled
with digits occurring earlier. When it comes to the said "box",
fill it with the smallest integer not used so far containing
the "boxed" digit.

For instance, what is the next term after 9?

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,...
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... we try "10" (smallest integer absent so far):

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,...
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... this "10" says two things:
1) "the 10th digit of S is present in a(10)" [true, the
10th digit of S being 1, and 1 being present in 10]
2) but "10" says also that the 11th term of S must show
a zero [as the 11th digit of S is now the 0 from 10]
... As there is no contradiction, with accept "10" as
extension of S -- but we must put a "0" in the "box" 11:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,[0]...
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... What is now the smallest integer unused so far that
contains a zero? This is 20 -- and we extend S with 20:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,...
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... this "20" says two things:
1) "the 20th digit of S is present in a(20)" [we will
thus fill the box 20 accordingly -- but later, as
we don't know now the 20th digit of S, say it is "D"]
2) but "20" says also that the 12th term of S must show
a "2" and the 13th term a "0". We fill thus the boxes
of the future terms #12 and #13 accordingly:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,[2][0]...D              [D]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... we see three boxes: the first one [2] will produce the
integer 12 (as 12 is the smallest integer containing "2"
and not yet present in S):

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,[0]...D              [D]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... this "12" says two things:
1) "the 12th digit of S is present in a(12)" [this is true,
as we wanted precisely that at the stage before]
2) but "12" says also that the 14th term of S must show
a "1" and the 15th term a "2". We fill thus the boxes
of the future terms #14 and #15 accordingly:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,[0][1][D2]...         [D]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22  22 22 22 22 33
read digit# vertically  01 23 45 67 89 01  23 45 67 89 01

... we see four boxes: the first one [0] will produce the
integer 30 (as 30 is the smallest integer containing "0"
and not yet present in S):

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,[1][D2]...         [D]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22  22 22 22 22 33
read digit# vertically  01 23 45 67 89 01  23 45 67 89 01

... this "30" says two things:
1) "the 30th digit of S is present in a(30)" [we will
thus fill the box 30 accordingly -- but later, as
we don't know now the 30th digit of S, say it is "E"]
2) but "30" says also that the 16th term of S must show
a "3" and the 17th term a "0". We fill thus the boxes
of the future terms #16 and #17 accordingly:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,[1][D2][3][0]...   [D]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22  22 22 22 22 33
read digit# vertically  01 23 45 67 89 01  23 45 67 89 01

... we see six boxes: the first one [1] will produce the
integer 11 (as 11 is the smallest integer containing "1"
and not yet present in S):

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,[D2][3][0]...   [D]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22  22 22 22 22 33
read digit# vertically  01 23 45 67 89 01  23 45 67 89 01

... this "11" says two things:
1) "the 11th digit of S is present in a(11)" [this is true,
as we wanted precisely earlier, "0" is in "20"]
2) but "11" says also that the 18th term of S must show
a "1" and the 19th term another "1". We fill thus the
boxes of the future terms #18 and #19 accordingly:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,[D2][3][0][1][1][D]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22  22 22 22 22 33
read digit# vertically  01 23 45 67 89 01  23 45 67 89 01

... we see seven boxes: the first one [D2] will produce the
integer 21 (as 21 is the smallest integer containing "2"
and not yet present in S); this forces D to be = 2:

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,21,[3][0][1][1][2]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... we can fill the next boxes quite easily now (as we have
understood the "smallest-available-integer-containing-the-
digit-in-the-box" trick); please note that the succession
of the boxes, above, is given by S itself (by the succession
of S's digits itself, to be more precise: [3][0][1][1][2]...
comes from the integers just before the boxes: 30,11,21,...
We see thus that the boxes' content is given by the terms
of S itself); we will replace now the boxes, one by one, by
a fresh integer (the smallest available one, as always):

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,21,13,[0][1][1][2]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,21,13,40,[1][1][2]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,21,13,40,14,[1][2]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,21,13,40,14,15,[2]...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

a(n)= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,21,13,40,14,15,22,...[E]
digit 1 2 3 4 5 6 7 8 9 11 11 11 11 11 22 22 22 22 22 33
read digit# vertically  01 23 45 67 89 01 23 45 67 89 01

... the next boxes will thus be filled like this:
[1][3][4][0][1][4][1][5][2][2]...
... they are produced by the upstream integers 13,40,14,15,22,

Best,
É.

```