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.
11, 9, 13, 14, 15, 16, 17, 18, 19, 20, 180, 1, 13, 37, 55, 73, 91, 109, 127, 145, 221, 17, 1, 34, 37, 55, 73, 91, 109, 127, 231, 35, 17, 1, 55, 37, 55, 73, 91, 109, 241, 53, 35, 17, 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
Offset: 0
Examples
a(0) = 11 as the string '0' first appears at position 1 and again at position 12, giving a difference of 11. 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. 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.
Links
- Scott R. Shannon, Image of the first 100000 terms.
Programs
-
Python
from itertools import count def A342162(n): s1, s2, m = tuple(int(d) for d in str(n)), tuple(), -1 l = len(s1) for i, s in enumerate(int(d) for k in count(0) for d in str(k)): s2 = (s2+(s,))[-l:] if s2 == s1: if m >= 0: return i-m m = i # Chai Wah Wu, Feb 18 2022
Comments