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.

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

This page as a plain text file.
%I A031297 #34 Mar 24 2025 05:57:38
%S A031297 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 A031297 44,46,48,50,17,37,56,3,60,62,64,66,68,70,19,39,59,78,4,82,84,86,88,
%U A031297 90,21,41,61,81,100,5,104,106,108,110,23,43,63,83
%N A031297 a(n) is the least k such that the base-10 representation of n begins at s(k), where s=A007376.
%C A031297 A229186 is the same sequence including the a(0) term.
%H A031297 Nathaniel Johnston, <a href="/A031297/b031297.txt">Table of n, a(n) for n = 1..10000</a>
%e A031297 a(1) = a(12) = a(123) = 1 since they each start at index 1 in 0123.
%e A031297 a(21) = 15 since it appears first at index 15 in 012345678910111213.
%p A031297 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 A031297 nmax = 100;
%t A031297 s = Table[IntegerDigits[n], {n, 0, nmax}] // Flatten;
%t A031297 a[n_] := SequencePosition[s, IntegerDigits[n], 1][[1, 1]] - 1;
%t A031297 Array[a, nmax] (* _Jean-François Alcover_, Feb 21 2021 *)
%o A031297 (Python)
%o A031297 from itertools import count, islice
%o A031297 def agen():
%o A031297     k, chap = 0, "0"
%o A031297     for n in count(1):
%o A031297         target = str(n)
%o A031297         while chap.find(target) == -1: k += 1; chap += str(k)
%o A031297         yield chap.find(target)
%o A031297 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Oct 06 2022
%Y A031297 Cf. A007376, A229186 (same sequence but including the a(0) term).
%Y A031297 Cf. A165449.
%Y A031297 Cf. A030304 (binary variant).
%K A031297 nonn,easy,look,base
%O A031297 1,2
%A A031297 _Clark Kimberling_