### MikeMirzayanov's blog

By MikeMirzayanov, 5 years ago, translation,

Hello!

We supported the rendering of LaTeX-formulas with MathJax in new posts and comments. Now the formulas will be as beautiful as in problem statements. Drawback: they are displayed not immediately, but redrawn after the page is displayed. Old posts and comments are displayed in the old way (already a lot of old content, backward compatibility is very important). Note that if you edit old post, it will still be displayed in the old style.

Here are some example: $1 \le n \le 10^{12}$,  $c = \sqrt{a^2+b^2}$,  $i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>$.

• +1169

| Write comment?
 » 5 years ago, # |   +9 Can you write something here to see how it looks like?
•  » » 5 years ago, # ^ | ← Rev. 2 →   +9 $\sum_{i=1}^{n}i=\frac{n \cdot (n+1)}{2}$
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +5 I understand. It need like this. yor need use double dollar sign to include your code $\frac{a}{b}$
•  » » » 5 years ago, # ^ |   0 Thanks a lot.
•  » » 5 years ago, # ^ |   +8 $\forall \varepsilon\!>\!0 \ \exists k(\varepsilon)\!\in\!N: \forall n>k \Rightarrow |x_{n}-a|<\varepsilon$You have to use $or $$like in LateX •  » » 5 years ago, # ^ | +45 a^2 $a^2$$$a^2$\$ $a^2$
 » 5 years ago, # |   +27 $G_{ij}=\sum_k F_{ik}F_{jk}$
•  » » 5 years ago, # ^ |   +5 Sound matrix multiplications am I right? :D
•  » » » 5 years ago, # ^ |   +13 Maybe Sound signal can use the function too? I use the Gamma Matrix to calculate the loss function with higher CNN-layer similarity in Picture Style Transfer.
•  » » » » 5 years ago, # ^ |   +13 Whoa, slow down senpai, I need a few more time to be familiar with ML models. :D
 » 5 years ago, # |   +244 Ah niceThe old style: The new one: $\lfloor \sqrt{x} \rfloor - \lfloor \sqrt{y} \rfloor \le \frac{x-y}{\sqrt{x}+\sqrt{y}} + 1 \le \frac{1}{\sqrt{x-y}+1}(x-y) + 1$Looks so much better!
•  » » 5 years ago, # ^ |   0 much more pretty right :D
 » 5 years ago, # | ← Rev. 2 →   -17 Good job
 » 5 years ago, # |   +23 $LOL$
 » 5 years ago, # | ← Rev. 2 →   +130 $\text{C}_{\text{ode}}\text{F}_{\text{orces}}\text{ Round}_{547} \text{ Please}$
•  » » 5 years ago, # ^ | ← Rev. 3 →   +35 It seems there is an error on displaying when I change the revision of comment to see. Check the revision 1 and move back to revision 2 of my comment then you will see the bug. MikeMirzayanov It's fixed
 » 5 years ago, # |   +22 $\mathbb{CODEFORCES}$
•  » » 5 years ago, # ^ |   +79 $\mathfrak{CodeForces}$
•  » » » 5 years ago, # ^ |   -8 nice
 » 5 years ago, # |   +156 $\displaystyle \sum_{i=1}^{\infty} i = -\frac{1}{12}$
 » 5 years ago, # |   +55 What was the LaTeX renderer before? I always thought it was some kind of Russian bootleg MathJax.
 » 5 years ago, # |   +36 $\begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \end{matrix}$
 » 5 years ago, # | ← Rev. 2 →   +13 $\int_G f(g) \, \text{d}g = \frac{1}{|W|} \int_G \int_T \mathopen| \Delta(t) \mathclose|^2 f(gtg^{-1}) \, \text{d}t \, \text{d}g$Looks very pretty :) $1+2=3<4$
 » 5 years ago, # |   +57 $\huge \mathcal{O}( N )$
»
5 years ago, # |
+71

### Testing

$\mathrm{f}[u]=b_u+\min\limits_{\substack{v\in anc_u\\\mathrm{dis}[u]-\mathrm{dis}[v]\le l_u}}(\mathrm{f}[v]-\mathrm{dis}[v]\times p_u)$

If $f(x)=\frac{1}{1-x^k}$, then $g(x)=(\ln f)(x)=\sum_{i=1}^{\infty}\frac{1}{i}x^{ik}$. Proof:

\begin{aligned}g(x)&=\ln f(x)\\&=\int(\frac{\mathrm{d}}{\mathrm{d}x}\ln f)(x)\mathrm{d}x\\&=\int(\frac{f'(x)}{f(x)})\mathrm{d}x\\&=\int((1-x^k)f'(x))\mathrm{d}x\\&=\int((1-x^k)\sum_{i=1}^{\infty}k\cdot i\cdot x^{ki-1})\mathrm{d}x\\&=\int(\sum_{i=1}^{\infty}k\cdot i\cdot x^{ki-1}-\sum_{i=1}^{\infty}k\cdot i\cdot x^{ki-1}\cdot x^k)\mathrm{d}x\\&=\int(\sum_{i=1}^{\infty}k\cdot i\cdot x^{ki-1}-\sum_{i=1}^{\infty}k\cdot (i-1)\cdot x^{ki-1})\mathrm{d}x\\&=\int(\sum_{i=1}^{\infty}k\cdot x^{ki-1})\mathrm{d}x\\&=\sum_{i=1}^{\infty}\frac{1}{i}x^{ki}\end{aligned}
•  » » 5 years ago, # ^ | ← Rev. 2 →   +73 I think, that you forgot to try \left( instead ( and \right) instead ). This allows to auto detect correct height of parentheses under summation, like this: $\prod_{k=1}^{n-1} \left(\exp{\left(\dfrac{2 \cdot \pi \cdot i \cdot k}{n}\right)}-1\right) = \left(-1\right)^{n+1} \cdot n$
•  » » » 5 years ago, # ^ |   0 Yeah, you're right. But sometimes it's too complicated.
 » 5 years ago, # |   0 Can explain me why backward compatibility is very important?
 » 5 years ago, # | ← Rev. 4 →   0 Deleted and screw uplaoding a photo
 » 5 years ago, # |   +8 $\text{summitwei} \in \text{geniosity}$Proof left as an exercise to the reader.
•  » » 5 years ago, # ^ |   +8 $\text{fishy} \not\in \text{geniosity}$I have already proved this B).
•  » » 5 years ago, # ^ |   +3 hello, my platinum blue men
•  » » » 5 years ago, # ^ |   +3 nchn orz
 » 5 years ago, # |   +7 $a^2$
 » 5 years ago, # |   +227 Nice, Now I can draw beautiful owls in my posts. Thanks Mike! $\underline{\widehat{\dbinom{\odot_\vee\odot}{{\raise-8pt"}\wr{\raise-8pt"}}}}$
•  » » 5 years ago, # ^ | ← Rev. 2 →   +36 LOL $\widetilde{ \dbinom{\odot_\vee\odot} {\underline{\ \smile\ }}}$ $\widetilde{ \dbinom{\odot_\vee\odot} {\underline{\ -\ }}}$ $\widetilde{ \dbinom{\odot_\vee\odot} {\underline{\ \frown\ }}}$
 » 5 years ago, # | ← Rev. 4 →   +5 $x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$
 » 5 years ago, # | ← Rev. 3 →   +117 $\require{AMScd}$ \begin{CD} T @>h>> A\\ @. @VV n V\\ M @<>e> !\\ \end{CD} $\frac{\color{purple}{4}}{\color{blue}{\Pi}} = \color{green}{1} + \cfrac{\color{red}{1}}{\color{orange}{2} + \cfrac{\color{red}{9}}{\color{orange}{2} + \cfrac{\color{red}{25}}{\color{orange}{2} + \cfrac{\color{red}{49}}{\color{orange}{2} + \dots}}}}$
•  » » 5 years ago, # ^ |   +5 red coder maths r very strong
 » 5 years ago, # | ← Rev. 6 →   +24 $\displaystyle \sum_{i=1}^n \sum_{j=1}^m d_1(\gcd(i, j)) \\ \displaystyle\sum_{d=1}^n \sum_{i=1}^n \sum_{j=1}^m d_1(d)[\gcd(i,j)=d])\\ \displaystyle\sum_{d=1}^n d_1(d) \sum_{i=1}^n \sum_{j=1}^m [\gcd(i,j)=d])\\ \displaystyle\sum_{d=1}^n d_1(d) \sum_{k=1}^{\lfloor \frac nd \rfloor} \mu(k) \lfloor \frac n{kd} \rfloor \displaystyle\lfloor \frac m{kd} \rfloor \\$Let $T=kd$, $\displaystyle\sum_{T=1}^n \lfloor \frac nT \rfloor \lfloor \frac mT \rfloor \sum_{d|T}d_1(d) \mu(\frac Td)$ $\displaystyle dp(i)=\min\limits_{i < j \leq n, dp(j)\leq \operatorname{sum}(j - 1) - \operatorname{sum}(i - 1)}(\operatorname{sum}(j - 1) - \operatorname{sum}(i - 1))$Why the \sum became \prod?....
•  » » 5 years ago, # ^ |   +5 Maybe you can use.. $\Sigma_{i=1}^n \Sigma_{j=1}^m d_1(\gcd(i, j))$\Sigma_{i=1}^n \Sigma_{j=1}^m d_1(\gcd(i, j))
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +6 It seems that it was fixed now, also thank you...
•  » » » » 5 years ago, # ^ |   +6 I'm just crack a joke,if you use the \Sigma,it will be too small...
 » 5 years ago, # |   +40 $a^{n}\equiv a^{\varphi(m)+(n \bmod \varphi(m))}\pmod{m}$
•  » » 5 years ago, # ^ |   +62 It is not always true when $n<\varphi(m)$. For example, $6^{2}\not\equiv 6^{4+2}\pmod8$.
•  » » » 5 years ago, # ^ |   +45 It's true for $n>\log_2 m$
•  » » » » 5 years ago, # ^ |   +27 More accurately, it's true for $n\ge\max_{i=1}^k\alpha_i$, where $m=p_1^{\alpha_1}p_2^{\alpha_2}\cdots p_k^{\alpha_k}$.
•  » » 5 years ago, # ^ |   0 what's the theory behind the fomula plz
•  » » » 5 years ago, # ^ |   +21 Let $m=p_1^{d_1} \dots p_n^{d_n}$. Consider the periodicity of $a^n$ on each $p_k^{d_k}$ separately. By Chinese Remainder Theorem, pre-period of $a^n$ modulo $m$ will be equal to the maximum of pre-periods modulo $p_k^{d_k}$ and period itself will be least common multiple of periods modulo $p_k^{d_k}$.On each $p_k^{d_k}$ pre-period will be either $0$ if $\gcd(a,p)=1$ or at most $d_k \leq \log_2 m$ otherwise. And period will always be the divisor of $\varphi(p_k^{d_k})$ which is in turn the divisor of $\varphi(m)$. Thus their least common multiple will be the divisor of $\varphi(m)$. This gives you the result above, given that $\varphi(m) \geq \log_2 m$.
•  » » » » 5 years ago, # ^ |   0 thank you vvery much. seems that I have a lot of things to catch up with
 » 5 years ago, # |   -10 I don't care. I want another codeforces round asap.
•  » » 5 years ago, # ^ |   +7 You can have hundreds of virtual contests.
 » 5 years ago, # | ← Rev. 2 →   +22 WoW, it's cool! Thank you~It was finally realized. A question about using LaTeX in blogs $\begin{bmatrix} F_i \\ F_{i-1} \\ (i+1)^3 \\ (i+1)^2 \\ i+1 \\ 1 \end{bmatrix} \Longleftarrow \begin{bmatrix} 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 3 & 3 & 1 \\ 0 & 0 & 0 & 1 & 2 & 1 \\ 0 & 0 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ \end{bmatrix} \times \begin{bmatrix} F_{i-1} \\ F_{i-2} \\ i^3 \\ i^2 \\ i \\ 1 \end{bmatrix}$
 » 5 years ago, # |   +44 The most convenient thing is that you can copy the formula by $\text{Right Click}\rightarrow\text{Show Math As}\rightarrow\text{TeX Commands}$.
 » 5 years ago, # |   +8 WAIT! Why all \sums became \prods? $\underset{\text{actually \sum}}{\underline{\sum}}\neq\underset{\text{real \prod}}{\underline{\prod}}$
•  » » 5 years ago, # ^ |   +8 Fixed!
 » 5 years ago, # | ← Rev. 2 →   +38 Looks like I found the following feature: If you use \newcommand or \renewcommand, it will affect all comments below yours. Apologies to all the people between my two comments that got confused by this.Stackexchange had the same issue, but there some people could at least edit the answers/comments and remove the malicious code. Their fix (mentioned in an answer to the linked post) was to wrap posts in \begingroup and \endgroup. Another fix mentioned there was to use \resetstack. MikeMirzayanov could you look into that?Edit: It looks like \newcommand and \renewcommand now get stripped from mathjax parts of comments. This should deal with people replacing $\pi$ with 40 owls for now. Nevertheless, I would love to see support for a \newcommand whose scope is just the comment it was written in. (But I see that implementing and testing that might take some time.)
 » 5 years ago, # | ← Rev. 3 →   +12 \begin{align*}\sum_{i=1}^n\sum_{j=1}^nij\gcd\left(i,j\right)&=\sum_{d=1}^nd\sum_{i=1}^n\sum_{j=1}^nij[\gcd\left(i,j\right)==d]\\&=\sum_{d=1}^nd^3\sum_{i=1}^{\lfloor\dfrac nd\rfloor}\sum_{j=1}^{\lfloor\dfrac nd\rfloor}ij[\gcd\left(i,j\right)==1]\\&=\sum_{d=1}^nd^3\sum_{i=1}^{\lfloor\dfrac nd \rfloor}\sum_{j=1}^{\lfloor\dfrac nd\rfloor}ij\sum_{t|\gcd\left(i,j\right)}\mu\left(t\right)\\&=\sum_{d=1}^nd^3\sum_{t=1}^{\lfloor\dfrac nd \rfloor}\mu\left(t\right)t^2\sum_{i=1}^{\lfloor\dfrac n{td}\rfloor}\sum_{j=1}^{\lfloor\dfrac n{td}\rfloor}ij\\&=\sum_{d=1}^nd^3\sum_{t=1}^{\lfloor\dfrac nd \rfloor}\mu\left(t\right)t^2\left(1+2+3+\cdots+\lfloor\dfrac n{td}\rfloor\right)^2\\&=\sum_{d=1}^nd^3\sum_{d|T}^n\mu\left(\dfrac Td\right)\left(\dfrac Td\right)^2sum^2\left(\lfloor\dfrac nT\rfloor\right)\\&=\sum_{T=1}^nsum^2\lfloor\dfrac nT\rfloor T^2\sum_{d|T}d\mu\left(\dfrac Td\right)\\&=\sum_{T=1}^nsum^2\lfloor\dfrac nT\rfloor T^2\phi\left(T\right)\end{align*}It is a great joy to solve mathematical problems using $LaTeX$ !
•  » » 5 years ago, # ^ |   -10 this is disgusting, genuinely
 » 5 years ago, # |   +20 $gcd(Fib_{a},Fib_{b})=Fib_{gcd(a,b)}$
•  » » 5 years ago, # ^ | ← Rev. 2 →   +5 More generally, $F_n \equiv 0 \mod F_m$ if $n \equiv 0 \mod m$.
•  » » 5 years ago, # ^ |   -8 Is this fomula true? What's this theroem called?
 » 5 years ago, # | ← Rev. 2 →   +21 \begin{equation*} e^{\pi i} + 1 = 0 \end{equation*}
 » 5 years ago, # |   +5 Well, Let's see some tables $\begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \end{array}$
 » 5 years ago, # |   -14 it doesnt work
 » 5 years ago, # | ← Rev. 6 →   -9 Testing $\sin \pi = 0$
•  » » 5 years ago, # ^ | ← Rev. 4 →   0 Testing a second time $\sin \pi = 0$Yep, dacin21's feature is still not fixed.
 » 5 years ago, # |   0 $2019 \ good \ luck \ and \ high \ rating$ $2019 \ become \ master:D$
•  » » 5 years ago, # ^ |   0 Wow, I find a person use the same picture as me! orz.
 » 5 years ago, # |   +7 $-\dfrac{\hslash^2}{2m} \, \dfrac{\mathrm{d}^2 \psi}{\mathrm{d} x^2}$
•  » » 5 years ago, # ^ |   +9 Oh boi we should forbid posting Hamiltonians on codeforces...
•  » » » 5 years ago, # ^ |   +2 $\begin{pmatrix}1&0\\0&-1\\\end{pmatrix}$
•  » » » 5 years ago, # ^ |   +14 strange suggestion, coming from a string theorist...
 » 5 years ago, # |   -27 and what does this have to do on a programming website? this website is for competitive programming, not math.
•  » » 5 years ago, # ^ |   +3 Relax competitive programming is just maths + coding
•  » » » 5 years ago, # ^ |   -14 do you realise what you're saying? just because some random website called codeforces decides to mess around with us by giving us terrible, useless problems full of math doesn't mean the whole thing called COMPETITIVE PROGRAMMING is like this. read before you comment because people who don't know better will take what you say as being true.
 » 5 years ago, # |   +28 \begin{CD} Me\\ @VV V\\ @>>> \\ solving\ problems @VVV @.\\ @<<< \\ @VVV\\ playing\ with\ LaTeX \end{CD}
•  » » 5 years ago, # ^ |   +6 $\LaTeX$
 » 5 years ago, # |   +6 It's fantastic! $f(x)=g(y)+1$
 » 5 years ago, # |   +6 Great!It will make codeforces better. :D$\frac{-b\pm\sqrt{b^2-4ac}}{2a}$
 » 5 years ago, # |   +30 $F(\omega_n^m)=F_0(\omega_{\frac{n}{2}}^m)+\omega_n^mF_1(\omega_{\frac{n}{2}}^m)$ $F(\omega_n^{m+\frac{n}{2}})=F_0(\omega_{\frac{n}{2}}^m)+\omega_n^{m+\frac{n}{2}}F_1(\omega_{\frac{n}{2}}^m)=F_0(\omega_{\frac{n}{2}}^m)-\omega_n^{m}F_1(\omega_{\frac{n}{2}}^m)$
 » 5 years ago, # |   +6 $c_i = \sum_{\gcd(j,k)=i} a_j \cdot b_k$
 » 5 years ago, # |   +8 $2\sum_{n=1}^n n^3$
 » 5 years ago, # | ← Rev. 2 →   +5 $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$ $\LaTeX$
 » 5 years ago, # |   +3 \begin{aligned}\left[ mx\right] =\sum ^{m}_{j=1}\left[ x+\dfrac {j-1}{m}\right] \left( m\in \mathbb{N} ^{+}\right) \end{aligned}​
 » 5 years ago, # |   +8 That's what you love :D AhmadLoiy
 » 5 years ago, # | ← Rev. 4 →   +8 $a_n=\sum_{k=0}^{n}\binom{n}{k}b_k\iff b_n=\sum_{k=0}^{n}(-1)^{n-k}\binom{n}{k}a_k$ $\int_a^bf(x)\text{d}x\approx\frac{b-a}{6}(f(a)+4f(\frac{a+b}{2})+f(b))$
 » 5 years ago, # |   +4 Is it rated ?
»
5 years ago, # |
0

Does it support Markdown and MathJax in the same post/comment ?

Here I'm trying to test both of this:

## Markdown & Latex Example

Codeforces is awesome!! Now let's try to write a matrix: Inline $\begin{bmatrix}a & b\ c & d\ e & f \end{bmatrix}$ and

Now in new line matrix:

$\begin{bmatrix}a & b\\ c & d\\ e & f \end{bmatrix}$

Seems it doesn't work in inline` form.

•  » » 5 years ago, # ^ |   +3 Use $\begin{bmatrix}a&b\\c&d\\e&f\end{bmatrix}$, I succeeded.
 » 5 years ago, # |   0 Great! $\boldsymbol{f}(n) = \sum_{d \mid n} \boldsymbol{\mu} \left( \frac{n}{d} \right) \boldsymbol{g}(d)$
 » 5 years ago, # |   0 (2 + 3) / 55
 » 5 years ago, # |   +5 $\bbox[5px,border:2px solid #B050FF] { \begin{array}{c|ccc} a \oplus b & 1 & 2 & 3 & 4 & 5 \\ \hline 1 & 0 & 3 & 2 & 5 & 4 \\ 2 & 3 & 0 & 1 & 6 & 7 \\ 3 & 2 & 1 & 0 & 7 & 6 \\ 4 & 5 & 6 & 7 & 0 & 1 \\ 5 & 4 & 7 & 6 & 1 & 0 \\ \end{array} }$
 » 5 years ago, # |   0 $\frac 1x = \frac 1a + \frac1b \\ \Downarrow \\ 1 = \frac xa + \frac xb \\ \Downarrow \\ 1 = \frac{xa+xb}{ab} \\ \Downarrow \\ xa+xb = ab \\ \Downarrow \\ xa = b\left(a - x\right) \Rightarrow xa - x^2 + x^2 = x\left(a - x\right) + x^2 \\ \Downarrow \\ x^2 = b(a-x) - x(a-x) = (a-x)(b-x)$
 » 5 years ago, # | ← Rev. 2 →   0 \begin{aligned} F(n) &= \sum_{d \mid n} f(d) \\ f(n) &= \sum_{d \mid n} F(d) \mu\!\left(\frac nd\right) \end{aligned}
 » 5 years ago, # |   0 new LaTex looks much better

Unable to parse markup [type=CF_MATHJAX]

•  » » 5 years ago, # ^ |   0 F(n)f(n)=∑d∣nf(d)=∑d∣nF(d)μ(nd)
•  » » 5 years ago, # ^ |   0 umm…… seem to be unable to use LaTex on my computer……
 » 5 years ago, # |   +6 $\begin{pmatrix} 1&2&3\\ 4&5&6\\ \end{pmatrix}$
 » 5 years ago, # |   0 It's so cool, I want to comment too : $\frac{d}{dx} \int_{a}^{x} f(t) \hspace{0.2cm} dt = f(x)$
 » 5 years ago, # | ← Rev. 2 →   0 Am I the only one who feels that it doesn't work now?Inline: $\frac{x}{y}\in\mathbb{R}$Block: $\frac{x}{y}\in\mathbb{R}$Displaystyle: $\displaystyle \frac{x}{y}\in\mathbb{R}$UPD: never mind, I've changed my browser recently, and now I seem to have to change my mathjax math renderer. Sorry for necroposting