%I #11 Dec 03 2016 12:06:56
%S 1,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,1,0,0,0,0,1,1,1,0,0,1,1,0,1,1,1,0,1,
%T 0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,
%U 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,0,0
%N Prime analog of Baum-Sweet sequence: a(n) = 1 if binary representation of n contains no block of consecutive zeros of exactly prime length; otherwise a(n) = 0.
%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 157.
%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.
%e a(4) = 0 because 4 (base 2) = 100, which has 2 (prime) consecutive zeros.
%e a(8) = 0 because 8 (base 2) = 1000, which has 3 (prime) consecutive zeros.
%e a(9) = 0 because 9 (base 2) = 1001, which has 2 (prime) consecutive zeros.
%e a(16) = 1 because 16 (base 2) = 10000, which has 4 (composite) consecutive zeros, even though there are sub-blocks of zeros of lengths 2 and 3.
%e a(32) = 0 because 32 (base 2) = 100000, which has 5 (prime) consecutive zeros.
%t f[n_] := If[Or @@ (First[ # ] == 0 && PrimeQ[Length[ # ]] &) /@ Split[IntegerDigits[n, 2]], 0, 1]; Table[f[n], {n, 0, 120}] (* _Ray Chandler_, Sep 16 2005 *)
%Y Cf. A037011, A086747, A110472, A110474.
%K base,easy,nonn
%O 0,1
%A _Jonathan Vos Post_, Sep 07 2005
%E Extended by _Ray Chandler_, Sep 16 2005
|