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 A332498 #9 Feb 15 2020 10:44:11 %S A332498 0,0,1,0,0,1,3,3,2,0,0,1,0,0,1,3,3,2,7,7,6,7,7,6,4,4,5,0,0,1,0,0,1,3, %T A332498 3,2,0,0,1,0,0,1,3,3,2,7,7,6,7,7,6,4,4,5,15,15,14,15,15,14,12,12,13, %U A332498 15,15,14,15,15,14,12,12,13,8,8,9,8,8,9,11,11 %N A332498 a(n) = y(w+1) where y(0) = 0 and y(k+1) = 2^(k+1)-1-y(k) (resp. y(k)) when d_k = 2 (resp. d_k <> 2) and Sum_{k=0..w} d_k*3^k is the ternary representation of n. Sequence A332497 gives corresponding x's. %H A332498 Rémy Sigrist, <a href="/A332498/b332498.txt">Table of n, a(n) for n = 0..6560</a> %H A332498 Wikipedia, <a href="https://en.wikipedia.org/wiki/T-square_(fractal)">T-square (fractal)</a> %F A332498 a(n) = 0 iff n belongs to A005836. %e A332498 For n = 42: %e A332498 - the ternary representation of 42 is "1120", %e A332498 - x(0) = 0, %e A332498 - x(1) = x(0) = 0 (as d_0 = 0), %e A332498 - x(2) = 2^2-1 - x(1) = 3 (as d_1 = 2), %e A332498 - x(3) = x(2) = 3 (as d_2 = 1 <> 2), %e A332498 - x(4) = x(3) = 3 (as d_3 = 1 <> 2), %e A332498 - hence a(42) = 3. %o A332498 (PARI) a(n) = { my (y=0, k=1); while (n, if (n%3==2, y=2^k-1-y); n\=3; k++); y } %Y A332498 Cf. A005836, A332497 (corresponding x's and additional comments). %K A332498 nonn,base %O A332498 0,7 %A A332498 _Rémy Sigrist_, Feb 14 2020