OFFSET
1,1
COMMENTS
REFERENCES
J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 157.
LINKS
W. Zane Billings, Table of n, a(n) for n = 1..10000
J.-P. Allouche, Finite Automata and Arithmetic, Séminaire Lotharingien de Combinatoire, B30c (1993), 23 pp.
EXAMPLE
a(1) = 9 because 9 (base 3) = 100, which has a block of 2 zeros.
a(2) = 18 because 18 (base 3) = 200, which has a block of 2 zeros.
a(3) = 27 because 27 (base 3) = 1000, which has a block of 3 zeros.
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 subblocks with 2 or 3 consecutive zeros because subblocks do not count here.
243 is in this sequence because 243 (base 3) = 100000, which has a block of 5 zeros.
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.
2187 is in this sequence because 2187 (base 3) = 10000000, which has a block of 7 zeros.
MATHEMATICA
Select[Range[250], Or @@ (First[ # ] == 0 && PrimeQ[Length[ # ]] &) /@ Split[IntegerDigits[ #, 3]] &] (* Ray Chandler, Sep 12 2005 *)
PROG
(Python)
from re import split
from sympy import isprime
def ternary (n):
if n == 0:
return '0'
nums = []
while n:
n, r = divmod(n, 3)
nums.append(str(r))
return ''.join(reversed(nums))
seq_list, n = [], 1
while len(seq_list) < 10000:
for d in split('1+|2+', ternary(n)[1:]):
if isprime(len(d)):
seq_list.append(n)
n += 1
# W. Zane Billings, Jun 28 2019
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Jonathan Vos Post, Sep 11 2005
STATUS
approved