Code Golf is a fun coding competition with participants aiming for the shortest possible code that implements an algorithm. But please feel free to post ANY code that solves the problem - just to have fun!
GOAL: write compact Wolfram Language (WL) code that generates TeX code given below to render fractal known as Sierpinski Triangle.
I've recently seen a tremendously lengthy TeX code that produced a nicely rendered Sierpinski triangle posted by @Szabolcs Horvát on social media. Because Wolfram Community has built-in MathML plugin (based on LaTeX ) we can see result right here!
$${{{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}^{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}_{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}}^{{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}^{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}_{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}}_{{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}^{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}_{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}}}^{{{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}^{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}_{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}}^{{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}^{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}_{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}}_{{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}^{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}_{{{x}^{x}_{x}}^{{x}^{x}_{x}}_{{x}^{x}_{x}}}}}_{{{{{x}^{x}_{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