login
a(n) = difference between the starting positions of the first two occurrences of n in the Champernowne string (starting at 0) 01234567891011121314151617181920... (cf. A033307).
10

%I #32 Feb 18 2022 19:13:07

%S 11,9,13,14,15,16,17,18,19,20,180,1,19,37,55,73,91,109,127,145,221,

%T 166,1,19,37,55,73,91,109,127,231,149,233,1,19,37,55,73,91,109,241,

%U 132,243,244,1,19,37,55,73,91,251,115,253,254,255,1,19,37,55,73,261,98,263,264,265,266,1,19

%N a(n) = difference between the starting positions of the first two occurrences of n in the Champernowne string (starting at 0) 01234567891011121314151617181920... (cf. A033307).

%C Consider the infinite string

%C 01234567891011121314151617181920... (cf. A033307)

%C formed by the concatenation of all decimal digits of all nonnegative numbers. From the position of the first digit of the first occurrence of the number n find the number of digits one has to move forward to get to the start of the second occurrence of n. This is a(n).

%H Scott R. Shannon, <a href="/A337227/a337227_1.png">Image of the first 100000 terms</a>.

%e The infinite string corresponding to the concatenation of all decimal digits >=0 starts "012345678910111213141516171819202122232425....".

%e a(0) = 11 because '0' appears at positions 1 and 12.

%e a(1) = 9 because '1' appears at positions 2 and 11.

%e a(10) = 180 because '10' appears starting at positions 11 and 191.

%e a(11) = 1 because '11' appears starting at positions 13 and 14.

%o (Python)

%o from itertools import count

%o def A337227(n):

%o s1 = tuple(int(d) for d in str(n))

%o s2 = s1

%o for i, s in enumerate(int(d) for k in count(n+1) for d in str(k)):

%o s2 = s2[1:]+(s,)

%o if s2 == s1:

%o return i+1 # _Chai Wah Wu_, Feb 18 2022

%Y Cf. A007376, A331162, A033307.

%Y Cf. A342162.

%K nonn,base,look

%O 0,1

%A _Scott R. Shannon_ and _N. J. A. Sloane_, Aug 19 2020