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.
%I A274005 #18 May 19 2023 08:02:12 %S A274005 1,2,4,8,16,32,62,120,222,410,728,1294,2220,3816,6380,10690,17486, %T A274005 28704,46180,74464,118226,188158,295062,464146,721500,1123384,1731646, %U A274005 2676538,4094776,6279380,9562698,14563312,22043302,33433502,50357062,75988618,114092544 %N 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. %H A274005 Rémy Sigrist, <a href="/A274005/a274005.gp.txt">PARI program for A274005</a> %e A274005 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. %p A274005 A274005 := proc(n) %p A274005 local a,b,lbdgs,bdgs,i,j,wrks,stri ; %p A274005 a := 0 ; %p A274005 for b from 0 to 2^n-1 do %p A274005 bdgs := convert(b,base,2) ; %p A274005 lbdgs := nops(bdgs) ; %p A274005 bdgs := [op(bdgs),seq(0,i=1..n-lbdgs)] ; %p A274005 wrks := true; %p A274005 for stri from 3 to n/2 do %p A274005 for i from 1 to n-stri do %p A274005 for j from i+1 to n-stri+1 do %p A274005 if abs(add(bdgs[u],u=i..i+stri-1) - add(bdgs[u],u=j..j+stri-1)) >2 then %p A274005 wrks := false; %p A274005 end if ; %p A274005 if not wrks then %p A274005 break; %p A274005 end if; %p A274005 end do: %p A274005 end do: %p A274005 if not wrks then %p A274005 break; %p A274005 end if; %p A274005 end do ; %p A274005 if wrks then %p A274005 a := a+1 ; %p A274005 end if; %p A274005 end do: %p A274005 a ; %p A274005 end proc: # _R. J. Mathar_, Jun 16 2016 %o A274005 (PARI) See Links section. %Y A274005 Cf. A005598, which is the analogous sequence where "2" is replaced by "1". %Y A274005 Cf. A362063. %K A274005 nonn %O A274005 0,2 %A A274005 _Jeffrey Shallit_, Jun 06 2016 %E A274005 More terms from _Rémy Sigrist_, Jun 24 2021