A356823 Tribternary numbers.
0, 1, 3, 4, 9, 10, 12, 27, 28, 30, 31, 36, 37, 81, 82, 84, 85, 90, 91, 93, 108, 109, 111, 112, 243, 244, 246, 247, 252, 253, 255, 270, 271, 273, 274, 279, 280, 324, 325, 327, 328, 333, 334, 336, 729, 730, 732, 733, 738, 739, 741, 756, 757, 759, 760, 765, 766, 810, 811, 813, 814, 819
Offset: 1
Programs
-
Mathematica
Select[Range[0, 1000], SequenceCount[IntegerDigits[#, 3], {1, 1, 1}] == 0 && SequenceCount[IntegerDigits[#, 3], {2}] == 0 &]
-
Python
import heapq from itertools import islice def agen(): # generator of terms, using recursion in Comments x, h = None, [0] while True: x, oldx = heapq.heappop(h), x if x != oldx: yield x for t in [3*x, 9*x+1, 27*x+4]: heapq.heappush(h, t) print(list(islice(agen(), 62))) # Michael S. Branicky, Aug 30 2022
Comments