login
A031297
a(n) is the least k such that the base-10 representation of n begins at s(k), where s=A007376.
7
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, 44, 46, 48, 50, 17, 37, 56, 3, 60, 62, 64, 66, 68, 70, 19, 39, 59, 78, 4, 82, 84, 86, 88, 90, 21, 41, 61, 81, 100, 5, 104, 106, 108, 110, 23, 43, 63, 83
OFFSET
1,2
COMMENTS
A229186 is the same sequence including the a(0) term.
LINKS
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
Cf. A007376, A229186 (same sequence but including the a(0) term).
Cf. A165449.
Sequence in context: A077741 A132575 A239235 * A239086 A306866 A187769
KEYWORD
nonn,easy,look,base
STATUS
approved