%I #9 Aug 30 2022 13:42:41
%S 0,1,3,4,9,10,12,27,28,30,31,36,37,81,82,84,85,90,91,93,108,109,111,
%T 112,243,244,246,247,252,253,255,270,271,273,274,279,280,324,325,327,
%U 328,333,334,336,729,730,732,733,738,739,741,756,757,759,760,765,766,810,811,813,814,819
%N Tribternary numbers.
%C These are numbers whose ternary representations consist only of zeros and ones and do not have three consecutive ones.
%C The sequence of Tribternary numbers can be constructed by writing out the Tribonacci representations of nonnegative integers and then evaluating the result in ternary.
%C These are Tribbinary numbers written in base 2 and evaluated in base 3.
%C These numbers are similar to Fibbinary numbers A003714, Fibternary numbers A003726, and Tribbinary numbers A060140.
%C Tribbinary numbers A060140 are a subsequence.
%C Subsequence of A005836.
%C The number of Tribternary numbers less than any power of three is a Tribonacci number.
%C We can generate this sequence recursively: start with 0 and 1; then, if x is in the sequence add 3x, 9x+1, and 27x+4 to the sequence.
%C The n-th Tribternary number is divisible by 3 if the n-th term of the Tribonacci word is a. Respectively, the n-th Tribbinary number is of the form 9x+1 if the n-th term of the Tribonacci word is b, and the n-th Tribbinary number is of the form 27x+4 if the n-th term of the Tribonacci word is c.
%C Every nonnegative integer can be written as a sum of three Tribternary numbers.
%C Every number has a Tribternary multiple.
%t Select[Range[0, 1000], SequenceCount[IntegerDigits[#, 3], {1, 1, 1}] == 0 && SequenceCount[IntegerDigits[#, 3], {2}] == 0 &]
%o (Python)
%o import heapq
%o from itertools import islice
%o def agen(): # generator of terms, using recursion in Comments
%o x, h = None, [0]
%o while True:
%o x, oldx = heapq.heappop(h), x
%o if x != oldx:
%o yield x
%o for t in [3*x, 9*x+1, 27*x+4]: heapq.heappush(h, t)
%o print(list(islice(agen(), 62))) # _Michael S. Branicky_, Aug 30 2022
%Y Cf. A003714, A003726, A005836, A060140.
%K nonn,base
%O 1,3
%A _Tanya Khovanova_ and PRIMES STEP Senior group, Aug 29 2022