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 A350229 #30 Jan 24 2022 16:11:23 %S A350229 0,2,2,4,6,4,6,8,8,10,12,12,14,16,12,14,16,16,18,20,20,22,24,22,24,26, %T A350229 26,28,30,30,32,34,32,34,36,36,38,40,40,42,44,38,40,42,42,44,46,46,48, %U A350229 50,48,50,52,52,54,56,56,58,60,58,60,62,62,64,66,66,68 %N A350229 a(n) is the sum of n and the balanced ternary digits in n. %C A350229 The image of this sequence is the set of nonnegative even numbers (A005843). %F A350229 a(n) = n + A065363(n). %F A350229 a(n) = n iff n belongs to A174658. %e A350229 For n = 42: %e A350229 - the balanced ternary representation of 42 is "1TTT0", %e A350229 - so a(42) = 42 + 1 - 1 - 1 - 1 + 0 = 40. %t A350229 Array[# + Total[If[First@ # == 0, Rest@ #, #] &[Prepend[IntegerDigits[#, 3], 0] //. {x___, y_, k_ /; k > 1, z___} :> {x, y + 1, k - 3, z}]] &, 70, 0] (* _Michael De Vlieger_, Jan 15 2022 *) %o A350229 (PARI) a(n) = my (v=n, d); while (n, n=(n-d=[0,1,-1][1+n%3])/3; v+=d); v %Y A350229 See A062028, A092391, A230641 for similar sequences. %Y A350229 Cf. A005843, A065363, A174658 (fixed points). %K A350229 nonn,base,easy %O A350229 0,2 %A A350229 _Rémy Sigrist_, Jan 09 2022