OFFSET
0,2
LINKS
Rémy Sigrist, PARI program for A274005
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
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, Jun 06 2016
EXTENSIONS
More terms from Rémy Sigrist, Jun 24 2021
STATUS
approved