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... .

This page as a plain text file.
%I A181362 #29 Jul 31 2025 20:22:37
%S A181362 1,15,37,59,81,103,125,147,169,214,235,271,307,533,836,1139,1442,1745,
%T A181362 2048,2651,541,708,978,1308,1608,1908,2208,2508,2808,4115,2684,3020,
%U A181362 3424,3428,4232,4331,4375,4419,4463,6652,3229,4595,4639,4679,4719,4767
%N A181362 a(n) is the starting position of the n-th occurrence of n in the string 123456789101112131415161718192021... .
%H A181362 Robert Israel, <a href="/A181362/b181362.txt">Table of n, a(n) for n = 1..2000</a>
%H A181362 Project Euler, <a href="https://projecteuler.net/problem=305">Problem 305: Reflexive Position</a>
%p A181362 M:= 10000: S:= cat(seq(i,i=1..M)):
%p A181362 f:= proc(n) local i,R; global S, M;
%p A181362    R:= [StringTools:-SearchAll(sprintf("%d",n),S)];
%p A181362    while nops(R) < n do
%p A181362        S:= cat(S, seq(i,i=M+1..2*M));
%p A181362        M:= 2*M;
%p A181362        R:= [StringTools:-SearchAll(sprintf("%d",n),S)];
%p A181362    od;
%p A181362    R[n]
%p A181362 end proc:
%p A181362 map(f, [$1..100]); # _Robert Israel_, Jul 31 2025
%o A181362 (Python)
%o A181362 def a(n):
%o A181362     # a(n) is the starting position of the n-th occurrence of n in
%o A181362     # the string 123456789101112131415161718192021    .
%o A181362     full='~'+''.join(map(str,range(1,10000)))
%o A181362     def place(n,str_n,offset):
%o A181362         p=full[offset:].find(str_n)+offset
%o A181362         return p if n==1 else place(n-1,str_n,p+1)
%o A181362     return place(n,str(n),0)
%o A181362 # prints the first fifty terms
%o A181362 print(', '.join(str(a(i)) for i in range(1,51)))
%Y A181362 Cf. A033307, A031297 (first occurrence).
%K A181362 nonn,base
%O A181362 1,2
%A A181362 Jon Palin (jon.palin(AT)gmail.com), Oct 15 2010