login
a(n) is the least k such that the base-10 representation of n begins at s(k), where s=A007376.
7

%I #30 Oct 07 2022 12:02:53

%S 1,2,3,4,5,6,7,8,9,10,12,1,16,18,20,22,24,26,28,30,15,34,2,38,40,42,

%T 44,46,48,50,17,37,56,3,60,62,64,66,68,70,19,39,59,78,4,82,84,86,88,

%U 90,21,41,61,81,100,5,104,106,108,110,23,43,63,83

%N a(n) is the least k such that the base-10 representation of n begins at s(k), where s=A007376.

%C A229186 is the same sequence including the a(0) term.

%H Nathaniel Johnston, <a href="/A031297/b031297.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = a(12) = a(123) = 1 since they each start at index 1 in 0123.

%e a(21) = 15 since it appears first at index 15 in 012345678910111213.

%p with(StringTools): s:="": for n from 1 to 70 do s:=cat(s,convert(n,string)): od: seq(Search(convert(n, string), s), n=1..70); # _Nathaniel Johnston_, May 26 2011

%t nmax = 100;

%t s = Table[IntegerDigits[n], {n, 0, nmax}] // Flatten;

%t a[n_] := SequencePosition[s, IntegerDigits[n], 1][[1, 1]] - 1;

%t Array[a, nmax] (* _Jean-François Alcover_, Feb 21 2021 *)

%o (Python)

%o from itertools import count, islice

%o def agen():

%o k, chap = 0, "0"

%o for n in count(1):

%o target = str(n)

%o while chap.find(target) == -1: k += 1; chap += str(k)

%o yield chap.find(target)

%o print(list(islice(agen(), 70))) # _Michael S. Branicky_, Oct 06 2022

%Y Cf. A007376, A229186 (same sequence but including the a(0) term).

%Y Cf. A165449.

%K nonn,easy,look,base

%O 1,2

%A _Clark Kimberling_