%N Numbers n such that n in ternary representation (A007089) has a block of exactly a prime number of consecutive zeros.
%C Related to the Baum-Sweet sequence, but ternary rather than binary and prime rather than odd.
%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.
%F a(n) is in this sequence iff n (base 3) = A007089(n) has a block (not a sub-block) of a prime number (A000040) of consecutive zeros.
%e a(1) = 9 because 9 (base 3) = 100, which has a block of 2 zeros.
%e a(2) = 18 because 18 (base 3) = 200, which has a block of 2 zeros.
%e a(3) = 27 because 27 (base 3) = 1000, which has a block of 3 zeros.
%e 81 is not in this sequence because 81 (base 3) = 10000 has a block of 4 consecutive zeros and it does not matter that this has sub-blocks with 2 or 3 consecutive zeros because sub-blocks do not count here.
%e 243 is in this sequence because 243 (base 3) = 100000, which has a block of 5 zeros.
%e 252 is in this sequence because 252 (base 3) = 100100 which has two blocks of 2 consecutive zeros, but we do not require there to be only one such prime-zeros block.
%e 2187 is in this sequence because 2187 (base 3) = 10000000, which has a block of 7 zeros.
%t Select[Range, Or @@ (First[ # ] == 0 && PrimeQ[Length[ # ]] &) /@ Split[IntegerDigits[ #, 3]] &] (* _Ray Chandler_, Sep 12 2005 *)
%Y Cf. A007089, A037011, A086747, A110471, A110472, A110474.
%A _Jonathan Vos Post_, Sep 11 2005