OFFSET
1,2
COMMENTS
A229186 is the same sequence including the a(0) term.
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = a(12) = a(123) = 1 since they each start at index 1 in 0123.
a(21) = 15 since it appears first at index 15 in 012345678910111213.
MAPLE
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
MATHEMATICA
nmax = 100;
s = Table[IntegerDigits[n], {n, 0, nmax}] // Flatten;
a[n_] := SequencePosition[s, IntegerDigits[n], 1][[1, 1]] - 1;
Array[a, nmax] (* Jean-François Alcover, Feb 21 2021 *)
PROG
(Python)
from itertools import count, islice
def agen():
k, chap = 0, "0"
for n in count(1):
target = str(n)
while chap.find(target) == -1: k += 1; chap += str(k)
yield chap.find(target)
print(list(islice(agen(), 70))) # Michael S. Branicky, Oct 06 2022
CROSSREFS
KEYWORD
AUTHOR
STATUS
approved