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 A244042 #21 Nov 11 2019 10:27:57 %S A244042 0,1,0,3,4,3,0,1,0,9,10,9,12,13,12,9,10,9,0,1,0,3,4,3,0,1,0,27,28,27, %T A244042 30,31,30,27,28,27,36,37,36,39,40,39,36,37,36,27,28,27,30,31,30,27,28, %U A244042 27,0,1,0,3,4,3,0,1,0,9,10,9,12,13,12,9,10,9 %N A244042 In ternary representation of n, replace 2's with 0's. %H A244042 Alois P. Heinz, <a href="/A244042/b244042.txt">Table of n, a(n) for n = 0..6560</a> %F A244042 a(n) = n - 2 * A005836(A289814(n) + 1) = A005836(A289813(n) + 1). - _Andrey Zabolotskiy_, Nov 11 2019 %e A244042 16 = 121_3, replacing 2 with 0 gives 101_3 = 10, so a(16) = 10. %p A244042 a:= proc(n) local t, r, i; t, r:= n, 0; %p A244042 for i from 0 while t>0 do %p A244042 r:= r+3^i*(d-> `if`(d=2, 0, d))(irem(t, 3, 't')) %p A244042 od; r %p A244042 end: %p A244042 seq(a(n), n=0..80); # _Alois P. Heinz_, Jun 17 2014 %t A244042 Array[FromDigits[IntegerDigits[#, 3] /. 2 -> 0, 3] &, 72, 0] (* _Michael De Vlieger_, Mar 17 2018 *) %o A244042 (Python) %o A244042 from sympy.ntheory.factor_ import digits %o A244042 def a(n):return int("".join(map(str, digits(n, 3)[1:])).replace('2', '0'), 3) # _Indranil Ghosh_, Jun 10 2017 %o A244042 (PARI) a(n) = my(d=digits(n, 3)); fromdigits(apply(x->(if (x==2, 0, x)), d), 3); \\ _Michel Marcus_, Jun 10 2017 %Y A244042 Cf. A004488, A117966, A005836, A289813, A289814. %K A244042 nonn,base,look %O A244042 0,4 %A A244042 _Joonas Pohjonen_, Jun 17 2014