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.

A181362 a(n) is the starting position of the n-th occurrence of n in the string 123456789101112131415161718192021... .

Original entry on oeis.org

1, 15, 37, 59, 81, 103, 125, 147, 169, 214, 235, 271, 307, 533, 836, 1139, 1442, 1745, 2048, 2651, 541, 708, 978, 1308, 1608, 1908, 2208, 2508, 2808, 4115, 2684, 3020, 3424, 3428, 4232, 4331, 4375, 4419, 4463, 6652, 3229, 4595, 4639, 4679, 4719, 4767
Offset: 1

Views

Author

Jon Palin (jon.palin(AT)gmail.com), Oct 15 2010

Keywords

Crossrefs

Cf. A033307, A031297 (first occurrence).

Programs

  • Maple
    M:= 10000: S:= cat(seq(i,i=1..M)):
    f:= proc(n) local i,R; global S, M;
       R:= [StringTools:-SearchAll(sprintf("%d",n),S)];
       while nops(R) < n do
           S:= cat(S, seq(i,i=M+1..2*M));
           M:= 2*M;
           R:= [StringTools:-SearchAll(sprintf("%d",n),S)];
       od;
       R[n]
    end proc:
    map(f, [$1..100]); # Robert Israel, Jul 31 2025
  • Python
    def a(n):
        # a(n) is the starting position of the n-th occurrence of n in
        # the string 123456789101112131415161718192021    .
        full='~'+''.join(map(str,range(1,10000)))
        def place(n,str_n,offset):
            p=full[offset:].find(str_n)+offset
            return p if n==1 else place(n-1,str_n,p+1)
        return place(n,str(n),0)
    # prints the first fifty terms
    print(', '.join(str(a(i)) for i in range(1,51)))