login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A102026 Number of n-bit strings that contain no more than 4 zeros and no more than 2 leading and 2 trailing zeros. 2
2, 4, 7, 13, 25, 49, 97, 191, 375, 737, 1449, 2849, 5601, 11011, 21647, 42557, 83665, 164481, 323361, 635711, 1249775, 2456993, 4830321, 9496161, 18668961, 36702211, 72154647, 141852301, 278874281, 548252401, 1077835841, 2118969471 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

Used in the NRZ encoding to avoid substrings of more than 4 zeros.

REFERENCES

Raphael Reischuk, On avoiding monochrome substrings of length 5.

LINKS

Table of n, a(n) for n=1..32.

Raphael Reischuk, On avoiding monochrome substrings of length 5.

Index entries for linear recurrences with constant coefficients, signature (1,1,1,1,1).

FORMULA

G.f.: 2*x+4*x^2 -x^3*(7+6*x+5*x^2+4*x^3+3*x^4) / ( -1+x+x^2+x^3+x^4+x^5 ). - R. J. Mathar, Oct 27 2012

EXAMPLE

a(3) = 2^3 - 1 = 7, since '000' is not a valid string, but all others are.

MATHEMATICA

m[x_] := If[x <= 4, 2^x,

If[x == 5, 31,

m[x - 1] + m[x - 2] + m[x - 3] + m[x - 4] + m[x - 5]]]

c[x_] := If[x <= 2, 0,

If[x == 3, 1,

If[x == 4, 3,

If[x == 5, 6,

If[x == 6, 12,

If[x == 7, 23,

If[x == 8, 45, 2*c[x - 1] - c[x - 6]]]]]]]]

valid[x_] := m[x] - c[x]

CROSSREFS

Sequence in context: A082423 A176485 A119266 * A103204 A326174 A017995

Adjacent sequences:  A102023 A102024 A102025 * A102027 A102028 A102029

KEYWORD

nonn

AUTHOR

Raphael Reischuk (raphael(AT)stud.uni-saarland.de), Jun 18 2007

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 23 16:22 EST 2020. Contains 332177 sequences. (Running on oeis4.)