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.

Original entry on oeis.org

2, 0, 22, 47, 38, 436, 736, 2322, 3912, 47262, 123398, 263600, 679530, 725244, 8118161, 5690326
Offset: 0

Views

Author

Martin Y. Champel, Jan 25 2015

Keywords

Examples

			a(0) = 2 since 2! equals 2, which does not contain any '1'.
a(1) = 0 since 0! equals 1, which contains '1' but not '11'.
a(2) = 22 since 22! equals 1124000727777607680000, which contains '11', and 22 is the smallest integer for which this condition is met.
		

Crossrefs

Programs

  • Mathematica
    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 *)
  • 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++))
    for(n=1,6,print1(a(n),", ")) \\ Derek Orr, Jan 29 2015
    
  • 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)
    a(n)=my(m=0); while(max1s(m!)!=n, m++); m \\ Charles R Greathouse IV, Jan 30 2015
  • Python
    # Output doesn't include a(0).
    def A254042():
        index = 1
        k = 0
        f = 1
        u = '1'
        while True:
            sf = str(f)
            if u in sf and u+'1' not in sf:
                print("A254042("+str(index)+") = " +str(k))
                index += 1
                k = 0
                f = 1
                u +='1'
            k += 1
            f *= k
        return
    

Extensions

a(11) from Jon E. Schoenfield, Feb 22 2015
a(12), a(13) from Jon E. Schoenfield, Mar 07 2015, Mar 08 2015
a(14)-a(15) from Bert Dobbelaere, Oct 29 2018