login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A254042 a(n) is the smallest nonnegative integer such that a(n)! contains a string of exactly n consecutive 1's. 11

%I #76 Oct 26 2023 15:12:21

%S 2,0,22,47,38,436,736,2322,3912,47262,123398,263600,679530,725244,

%T 8118161,5690326

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

%e a(0) = 2 since 2! equals 2, which does not contain any '1'.

%e a(1) = 0 since 0! equals 1, which contains '1' but not '11'.

%e a(2) = 22 since 22! equals 1124000727777607680000, which contains '11', and 22 is the smallest integer for which this condition is met.

%t 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 (Python 2.7)

%o def A254042():

%o index = 1

%o k = 0

%o f = 1

%o u = '1'

%o while True:

%o sf = str(f)

%o if u in sf and u+'1' not in sf:

%o print "A254042("+str(index)+") = " +str(k)

%o index += 1

%o k = 0

%o f = 1

%o u +='1'

%o k += 1

%o f *= k

%o return

%o (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 for(n=1,6,print1(a(n),", ")) \\ _Derek Orr_, Jan 29 2015

%o (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 a(n)=my(m=0); while(max1s(m!)!=n, m++); m \\ _Charles R Greathouse IV_, Jan 30 2015

%Y Cf. A254447, A254448, A254449, A254500, A254501, A254502, A254716, A254717, A252652.

%K nonn,base,more

%O 0,1

%A _Martin Y. Champel_, Jan 25 2015

%E a(11) from _Jon E. Schoenfield_, Feb 22 2015

%E a(12), a(13) from _Jon E. Schoenfield_, Mar 07 2015, Mar 08 2015

%E a(14)-a(15) from _Bert Dobbelaere_, Oct 29 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 13 17:56 EDT 2024. Contains 375144 sequences. (Running on oeis4.)