%I #17 Sep 01 2021 22:22:55
%S 16,33,48,66,67,80,97,112,132,133,134,135,144,161,176,194,195,208,225,
%T 240,264,265,266,267,268,269,270,271,272,289,304,322,323,336,353,368,
%U 388,389,390,391,400,417,432,450,451,464,481,496,512,528,529,530,531
%N Numbers n such that n in binary representation has a block of exactly a nontrivial square number of zeros.
%C a(n) is the index of zeros in the complement of the square analog of the Baum-Sweet sequence, which is b(n) = 1 if the binary representation of n contains no block of consecutive zeros of exactly a nontrivial square number length; otherwise b(n) = 0.
%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 157.
%H Robert Israel, <a href="/A110502/b110502.txt">Table of n, a(n) for n = 1..10000</a>
%H J.-P. Allouche, <a href="http://www.mat.univie.ac.at/~slc/s/s30allouche.html">Finite Automata and Arithmetic</a>, Séminaire Lotharingien de Combinatoire, B30c (1993), 23 pp.
%F a(n) is in this sequence iff n (base 2) has a block (not a sub-block) of k^2 = A000290(k) consecutive zeros for k>1.
%e a(1) = 16 because 16 (base 2) = 10000, which has a block of 4 = 2^2 zeros.
%e a(2) = 33 because 33 (base 2) = 100001, which has a block of 4 zeros.
%e a(3) = 48 because 48 (base 2) = 110000, which has a block of 4 zeros.
%e a(49) = 512 because 512 (base 2) = 1000000000, with a block of 9 = 3^2 zeros.
%e Similarly, there are blocks of exactly 9 zeros in 1025, 1536, 2050, 2051, 3073, 3584, 7149, 8196, 8197, 8198, 8199.
%e 65536, 131073, 196608, 262146 and 262147 are in this sequence because (base 2) they each have a block of 16 = 4^2 zeros.
%e 33554432 has a block of 25 = 5^2 zeros.
%p filter:= proc(n) local L,nL,A,B;
%p L:= convert(n,base,2);
%p nL:= nops(L);
%p A:= select(t -> L[t]=0 and (t=1 or L[t-1]=1), [$1..nL]);
%p B:= select(t -> L[t]=1 and L[t-1]=0, [$2..nL]);
%p ormap(t -> t>3 and issqr(t),B-A)
%p end proc:select(filter, [$1..1000]); # _Robert Israel_, Sep 01 2021
%t Select[Range[531], Or @@ (First[ # ] == 0 && Length[ # ] > 1 && IntegerQ[Length[ # ]^(1/2)] &) /@ Split[IntegerDigits[ #, 2]] &] (* _Ray Chandler_, Sep 12 2005 *)
%o (Python)
%o from math import isqrt
%o from itertools import groupby
%o def is_nt_sqr(n): # is nontrivial square
%o return n > 1 and isqrt(n)**2 == n
%o def ok(n):
%o b = bin(n)[2:]
%o return any(k == '0' and is_nt_sqr(len(list(g))) for k, g in groupby(b))
%o print(list(filter(ok, range(532)))) # _Michael S. Branicky_, Sep 01 2021
%Y Cf. A000290, A037011, A086747, A110471, A110472, A110474.
%K base,easy,nonn
%O 1,1
%A _Jonathan Vos Post_, Sep 11 2005
%E Corrected and extended by _Ray Chandler_, Sep 12 2005