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.

A254042 a(n) is the smallest nonnegative integer such that a(n)! contains a string of exactly n consecutive 1's.

This page as a plain text file.
%I A254042 #82 Jan 30 2025 11:22:16
%S A254042 2,0,22,47,38,436,736,2322,3912,47262,123398,263600,679530,725244,
%T A254042 8118161,5690326
%N A254042 a(n) is the smallest nonnegative integer such that a(n)! contains a string of exactly n consecutive 1's.
%e A254042 a(0) = 2 since 2! equals 2, which does not contain any '1'.
%e A254042 a(1) = 0 since 0! equals 1, which contains '1' but not '11'.
%e A254042 a(2) = 22 since 22! equals 1124000727777607680000, which contains '11', and 22 is the smallest integer for which this condition is met.
%t A254042 f[n_] := Block[{k = 0, s = ToString[(10^n - 1)/9]}, While[ Length@ StringPosition[ ToString[k!], s] != 1, j = k++]; k]; f[0] = 2; Array[f, 12, 0] (* _Robert G. Wilson v_, Feb 27 2015 *)
%o A254042 (Python)
%o A254042 # Output doesn't include a(0).
%o A254042 def A254042():
%o A254042     index = 1
%o A254042     k = 0
%o A254042     f = 1
%o A254042     u = '1'
%o A254042     while True:
%o A254042         sf = str(f)
%o A254042         if u in sf and u+'1' not in sf:
%o A254042             print("A254042("+str(index)+") = " +str(k))
%o A254042             index += 1
%o A254042             k = 0
%o A254042             f = 1
%o A254042             u +='1'
%o A254042         k += 1
%o A254042         f *= k
%o A254042     return
%o A254042 (PARI) a(n)=k=0;while(k<10^4,d=digits(2*10^(#(digits(k!))+1)+10*k!);for(j=1,#d-n+1,c=0;for(i=j,j+n-1,if(d[i]==1,c++);if(d[i]!=1,c=0;break));if(c==n&&d[j+n]!=1&&d[j-1]!=1,return(k)));if(c==n,return(k));if(c!=n,k++))
%o A254042 for(n=1,6,print1(a(n),", ")) \\ _Derek Orr_, Jan 29 2015
%o A254042 (PARI) max1s(n)=my(v=digits(n),r,t);for(i=1,#v,if(v[i]==1,t++,r=max(r,t);t=0));max(t,r)
%o A254042 a(n)=my(m=0); while(max1s(m!)!=n, m++); m \\ _Charles R Greathouse IV_, Jan 30 2015
%Y A254042 Cf. A254447, A254448, A254449, A254500, A254501, A254502, A254716, A254717, A252652.
%K A254042 nonn,base,more
%O A254042 0,1
%A A254042 _Martin Y. Champel_, Jan 25 2015
%E A254042 a(11) from _Jon E. Schoenfield_, Feb 22 2015
%E A254042 a(12), a(13) from _Jon E. Schoenfield_, Mar 07 2015, Mar 08 2015
%E A254042 a(14)-a(15) from _Bert Dobbelaere_, Oct 29 2018