cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A342162 a(n) = difference between the starting positions of the first two occurrences of n in the Champernowne string (cf. A033307), where the first n is not required to be at its natural position.

This page as a plain text file.
%I A342162 #25 Feb 18 2022 16:10:51
%S A342162 11,9,13,14,15,16,17,18,19,20,180,1,13,37,55,73,91,109,127,145,221,17,
%T A342162 1,34,37,55,73,91,109,127,231,35,17,1,55,37,55,73,91,109,241,53,35,17,
%U A342162 1,76,37,55,73,91,251,71,53,35,17,1,97,37,55,73,261,89,71,53,35,17,1,118,37,55,271,107
%N A342162 a(n) = difference between the starting positions of the first two occurrences of n in the Champernowne string (cf. A033307), where the first n is not required to be at its natural position.
%C A342162 Consider the infinite string 01234567891011121314151617181920... (cf. A033307) 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, which is not required to be at its natural position in the string, 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).
%C A342162 This sequence is similar to A337227 but here the first appearance of n can be anywhere in string. The first example where n appears before its natural position in the string is n = 12. See the examples.
%H A342162 Scott R. Shannon, <a href="/A342162/a342162.png">Image of the first 100000 terms</a>.
%e A342162 a(0) = 11 as the string '0' first appears at position 1 and again at position 12, giving a difference of 11.
%e A342162 a(10) = 180 as the string '10' first appears at position 11 and again at position 191 (where it forms the start of the number 100), giving a difference of 180.
%e A342162 a(12) = 13 as the string '12' first appears at position 2 (the first number to appear before its natural position) and again at position 15 (its natural position), giving a difference of 13. This is the first term to differ from A337227.
%o A342162 (Python)
%o A342162 from itertools import count
%o A342162 def A342162(n):
%o A342162     s1, s2, m = tuple(int(d) for d in str(n)), tuple(), -1
%o A342162     l = len(s1)
%o A342162     for i, s in enumerate(int(d) for k in count(0) for d in str(k)):
%o A342162         s2 = (s2+(s,))[-l:]
%o A342162         if s2 == s1:
%o A342162             if m >= 0:
%o A342162                 return i-m
%o A342162             m = i # _Chai Wah Wu_, Feb 18 2022
%Y A342162 Cf A033307, A337227, A007376, A331162.
%K A342162 nonn,base
%O A342162 0,1
%A A342162 _Scott R. Shannon_, Mar 03 2021