login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A274005 Number of length-n binary sequences where the sum of each subblock differs by at most 2 from every other subblock of the same length. 2
1, 2, 4, 8, 16, 32, 62, 120, 222, 410, 728, 1294, 2220, 3816, 6380, 10690, 17486, 28704, 46180 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,2

LINKS

Table of n, a(n) for n=0..18.

EXAMPLE

For n = 6, the strings 000111 and 111000 are not counted, since the sum of length-3 subblocks that begin and end differ by 3.

MAPLE

A274005 := proc(n)

    local a, b, lbdgs, bdgs, i, j, wrks, stri ;

    a := 0 ;

    for b from 0 to 2^n-1  do

        bdgs := convert(b, base, 2) ;

        lbdgs := nops(bdgs) ;

        bdgs := [op(bdgs), seq(0, i=1..n-lbdgs)] ;

        wrks := true;

        for stri from 3 to n/2 do

            for i from 1 to n-stri do

            for j from i+1 to n-stri+1 do

                if abs(add(bdgs[u], u=i..i+stri-1) - add(bdgs[u], u=j..j+stri-1)) >2 then

                    wrks := false;

                end if ;

                if not wrks then

                    break;

                end if;

            end do:

            end do:

            if not wrks then

                break;

            end if;

        end do ;

        if wrks then

            a := a+1 ;

        end if;

    end do:

    a ;

end proc: # R. J. Mathar, Jun 16 2016

CROSSREFS

Cf. A005598, which is the analogous sequence where "2" is replaced by "1".

Sequence in context: A078389 A248847 A059173 * A027560 A135493 A216241

Adjacent sequences:  A274002 A274003 A274004 * A274006 A274007 A274008

KEYWORD

nonn,more

AUTHOR

Jeffrey Shallit, Jun 06 2016

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 19 20:17 EST 2019. Contains 320328 sequences. (Running on oeis4.)