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 A374362 #13 Jul 10 2024 02:59:10 %S A374362 0,0,1,0,0,1,3,3,4,0,0,1,0,0,1,3,3,4,9,9,10,9,9,10,12,12,13,0,0,1,0,0, %T A374362 1,3,3,4,0,0,1,0,0,1,3,3,4,9,9,10,9,9,10,12,12,13,27,27,28,27,27,28, %U A374362 30,30,31,27,27,28,27,27,28,30,30,31,36,36,37,36 %N A374362 a(n) is the least term t of A005836 such that n - t also belongs to A005836. %C A374362 To compute a(n): in the ternary expansion of n, replace 1's by 0's and 2's by 1's. %H A374362 Rémy Sigrist, <a href="/A374362/b374362.txt">Table of n, a(n) for n = 0..6561</a> %F A374362 a(n) = A374361(n, 0). %F A374362 a(n) = n - A374363(n). %F A374362 a(n) >= 0 with equality iff n belongs to A374361. %F A374362 a(n) = A005836(1 + A289814(n)). %e A374362 The first terms, in decimal and in ternary, are: %e A374362 n a(n) ter(n) ter(a(n)) %e A374362 -- ---- ------ --------- %e A374362 0 0 0 0 %e A374362 1 0 1 0 %e A374362 2 1 2 1 %e A374362 3 0 10 0 %e A374362 4 0 11 0 %e A374362 5 1 12 1 %e A374362 6 3 20 10 %e A374362 7 3 21 10 %e A374362 8 4 22 11 %e A374362 9 0 100 0 %e A374362 10 0 101 0 %e A374362 11 1 102 1 %e A374362 12 0 110 0 %e A374362 13 0 111 0 %e A374362 14 1 112 1 %e A374362 15 3 120 10 %o A374362 (PARI) a(n) = fromdigits(apply(d -> [0, 0, 1][1+d], digits(n, 3)), 3) %o A374362 (Python) %o A374362 from gmpy2 import digits %o A374362 def A374362(n): return int(digits(n,3).replace('1','0').replace('2','1'),3) # _Chai Wah Wu_, Jul 09 2024 %Y A374362 Cf. A005836, A289814, A374361. %K A374362 nonn,base %O A374362 0,7 %A A374362 _Rémy Sigrist_, Jul 06 2024