This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A060140 #40 May 22 2025 11:01:57 %S A060140 0,1,3,9,10,27,28,30,81,82,84,90,91,243,244,246,252,253,270,271,273, %T A060140 729,730,732,738,739,756,757,759,810,811,813,819,820,2187,2188,2190, %U A060140 2196,2197,2214,2215,2217,2268,2269,2271,2277,2278,2430,2431,2433,2439 %N A060140 Ordered set S defined by these rules: 0 and 1 are in S and if x is a nonzero number in S, then 3x and 9x+1 are in S. %C A060140 The numbers of the form 9x+1 occupy the same positions in S that 1 occupies in the infinite Fibonacci word (A003849). %C A060140 These are Fibternary numbers: numbers whose ternary representations consist only of zeros and ones and do not have two consecutive ones. The sequence of Fibternary numbers can be constructed by writing out the Zeckendorf representations of nonnegative integers and then evaluating the result in ternary. These numbers are similar to Fibbinary numbers A003714, Tribbinary numbers A060140, and Tribternary numbers A356823. The number of Fibternary numbers less than any power of three is a Fibonacci number. We can generate Fibternary numbers recursively: Start by adding 0 and 1 to the sequence. Then, if x is a number in the sequence add 3x and 9x+1 to the sequence. Every nonnegative integer can be written as the sum of four Fibternary numbers. Every number has a Fibternary multiple. - _Tanya Khovanova_ and PRIMES STEP Senior group, Aug 30 2022 %H A060140 Ivan Neretin, <a href="/A060140/b060140.txt">Table of n, a(n) for n = 0..10000</a> %H A060140 Clark Kimberling, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL3/goldentext.html">A Self-Generating Set and the Golden Mean</a>, J. Integer Sequences, 3 (2000), Article 00.2.8. %H A060140 Clark Kimberling, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Papers1/52-3/Kimberling11132013.pdf">Fusion, Fission, and Factors</a>, Fib. Q., 52 (2014), 195-202. %F A060140 a(n) = A005836(A003714(n)+1). - _Amiram Eldar_, Oct 28 2023 %t A060140 FromDigits[IntegerDigits[#, 2], 3] & /@ Select[Range[0, 165], BitAnd[#, 2*#] == 0 &] (* _Amiram Eldar_, Oct 28 2023 *) %o A060140 (Python) %o A060140 import heapq %o A060140 from itertools import islice %o A060140 def agen(): # generator of terms, using recursion in Comments %o A060140 yield 0; x, h = None, [1] %o A060140 while True: %o A060140 x = heapq.heappop(h) %o A060140 yield x %o A060140 for t in [3*x, 9*x+1]: heapq.heappush(h, t) %o A060140 print(list(islice(agen(), 51))) # _Michael S. Branicky_, Aug 30 2022 %o A060140 (Python) %o A060140 def A060140(n): %o A060140 tlist, s = [1,2], 0 %o A060140 while tlist[-1]+tlist[-2] <= n: %o A060140 tlist.append(tlist[-1]+tlist[-2]) %o A060140 for d in tlist[::-1]: %o A060140 s <<= 1 %o A060140 if d <= n: %o A060140 s += 1 %o A060140 n -= d %o A060140 return int(bin(s)[2:],3) # _Chai Wah Wu_, May 22 2025 %Y A060140 Cf. A003714, A003849, A005836, A060138, A060142, A356823. %K A060140 nonn %O A060140 0,3 %A A060140 _Clark Kimberling_, Mar 05 2001