Wednesday, December 4, 2019

computer puzzle - MathJax minus 1


(This puzzle relies on familiarity with MathJax, the mathematics renderer that is automatically available for use in answers here at Puzzling Stack Exchange. Examples and more information can be found in related puzzles.)



          1 of these days I’m going to cut you into little pieces.

            – complete lyrics to “One of These Days” by Pink Floyd



Here goes MathJax, rendering 8 ones in two ways that use 8 instances of   1 ,   \1   or   #1 .

$\require{begingroup} \begingroup \small \def \L #1#2#3#4{ \kern9em\begin{array}{r}\kern -9em\texttt {#1}\\ \kern-3em \texttt {#2} \\[ -.4ex] \texttt {#3} \\[ -.3ex] \texttt{#4} \\[1.5ex] \hline \normalsize #2 #3 \end{array} } \L {\$\$\require{begingroup}\begingroup} {\def \1#1{#1#1}} {\1{\1{11}}} {\endgroup\$\$} {} \kern2em \L {\$\$\require{begingroup}\begingroup} {\def \1#1 {#1 #1 }} {\1\111 } {\endgroup\$\$} {} \endgroup$

And here we go, cutting that second way into 13 little pieces:



    $$\require{begingroup}\begingroup\def{}\endgroup$$

         11\1\1\1#1#1#1



Can you discard one   1 ,   \1   or   #1   and assemble the remaining 12 pieces to render $\raise.2ex\strut 11111111$ again?



A solution should directly render the result. Spaces and multiple lines are allowed. For a closely related puzzle, see MathJax looks kool. Your browser page might need to be reloaded in order to reset MathJax after errors while testing.



Answer




This appears to work:



$$\require{begingroup}\begingroup \def\1#1 {#1 #11 } \1\1 \endgroup$$



(I confess I got there by largely-undirected trial and error.)


Here:


$$\require{begingroup}\begingroup \def\1#1 {#1 #11 } \1\1 \endgroup$$


Trace:


$$\require{begingroup}\begingroup \def\Rest#1{{\small\texttt{#1}}} \def\This#1{{ \small\, \rlap{ \texttt {#1} } \raise-.2ex{ \underline{\hphantom{ \texttt{#1} }} } }} \def \Trace #1#2 #3#4 \end{ & \kern-1.04em \This{#1}\This{#2} \kern.22em \Rest{#4} \\ & & \kern-1.2em \begin{array}{lll} \llap{\color{gray}\hookrightarrow~} \This{#3} \Rest{#4} ~ = & \bf #3#4 \end{array} \end } % \def\1#1 { \Trace \1#1 {#1 #11 }} % \begin{array}{lll} & % \1\1 \end{array} \endgroup$$


No comments:

Post a Comment

classical mechanics - Moment of a force about a given axis (Torque) - Scalar or vectorial?

I am studying Statics and saw that: The moment of a force about a given axis (or Torque) is defined by the equation: $M_X = (\vec r \times \...