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.

A358168 First n-digit number to occur in Van Eck's Sequence (A181391).

This page as a plain text file.
%I A358168 #30 Nov 06 2022 01:40:20
%S A358168 0,14,131,1024,10381,100881,1014748,10001558,100246289,1000943528,
%T A358168 10010107437
%N A358168 First n-digit number to occur in Van Eck's Sequence (A181391).
%C A358168 a(6)-a(7) from Chuck Gaydos.
%e A358168 a(2) = 14 because 14 is the first 2-digit number occurring in A181391.
%t A358168 nn = 2^20; q[_] = False; q[0] = True; a[_] = 0; c[_] = -1; c[0] = 2; m = 1; {0}~Join~Rest@ Reap[Do[j = c[m]; a[n] = m; c[m] = n; m = 0; If[j > 0, m = n - j]; If[! q[#2], Sow[#1]; q[#2] = True] & @@ {a[n], IntegerLength[a[n]]}, {n, 3, nn}] ][[-1, -1]] (* _Michael De Vlieger_, Nov 05 2022 *)
%o A358168 (Python)
%o A358168 from itertools import count
%o A358168 def A358168(n):
%o A358168     b, bdict, k = 0, {0:(1,)},10**(n-1) if n > 1 else 0
%o A358168     for m in count(2):
%o A358168         if b >= k:
%o A358168             return b
%o A358168         if len(l := bdict[b]) > 1:
%o A358168             b = m-1-l[-2]
%o A358168             if b in bdict:
%o A358168                 bdict[b] = (bdict[b][-1],m)
%o A358168             else:
%o A358168                 bdict[b] = (m,)
%o A358168         else:
%o A358168             b = 0
%o A358168             bdict[0] = (bdict[0][-1],m) # _Chai Wah Wu_, Nov 05 2022
%Y A358168 Cf. A181391, A358180.
%K A358168 nonn,base,hard,more
%O A358168 1,2
%A A358168 _G. L. Honaker, Jr._, Nov 01 2022
%E A358168 a(8)-a(10) from _Chai Wah Wu_, Nov 05 2022
%E A358168 a(11) from _Martin Ehrenstein_, Nov 05 2022