{"year": "2014", "tier": "T0", "problem_label": "1", "problem_type": null, "exam": "USA_TSTST", "problem": "Let $\\leftarrow$ denote the left arrow key on a standard keyboard. If one opens a text editor and types the keys \"ab $\\leftarrow \\mathrm{cd} \\leftarrow \\leftarrow \\mathrm{e} \\leftarrow \\leftarrow \\mathrm{f}$ \", the result is \"faecdb\". We say that a string $B$ is reachable from a string $A$ if it is possible to insert some amount of $\\leftarrow$ 's in $A$, such that typing the resulting characters produces $B$. So, our example shows that \"faecdb\" is reachable from \"abcdef\". Prove that for any two strings $A$ and $B, A$ is reachable from $B$ if and only if $B$ is reachable from $A$.", "solution": " Obviously $A$ and $B$ should have the same multiset of characters, and we focus only on that situation. Claim - If $A=123 \\ldots n$ and $B=\\sigma(1) \\sigma(2) \\ldots \\sigma(n)$ is a permutation of $A$, then $B$ is reachable if and only if it is $\\mathbf{2 1 3}$-avoiding, i.e. there are no indices $i0}$ such that $x \\equiv y \\equiv 1(\\bmod p)$. If the sequence $\\nu_{p}\\left(x^{n}-y\\right)$ of positive integers is nonconstant, then it is unbounded. For this it would be sufficient to prove the following claim. Claim - Let $p$ be an odd prime. Let $x, y \\in \\mathbb{Q}>0$ such that $x \\equiv y \\equiv 1(\\bmod p)$. Suppose $m$ and $n$ are positive integers such that $$ d=\\nu_{p}\\left(x^{n}-y\\right)<\\nu_{p}\\left(x^{m}-y\\right)=e . $$ Then there exists $\\ell$ such that $\\nu_{p}\\left(x^{\\ell}-y\\right) \\geq e+1$. $$ \\nu_{p}\\left(x^{k}-1\\right)=e $$ namely $k=p^{e-d}|m-n|$. (In fact, one could also choose more carefully $k=p^{e-d} \\cdot \\operatorname{gcd}(m-$ $\\left.n, p^{\\infty}\\right)$, so that $k$ is a power of $p$.) Suppose we set $x^{k}=p^{e} u+1$ and $x^{m}=p^{e} v+y$ where $u, v \\in \\mathbb{Q}$ aren't divisible by $p$. Now for any integer $1 \\leq r \\leq p-1$ we consider $$ \\begin{aligned} x^{k r+m}-y & =\\left(p^{e} u+1\\right)^{r} \\cdot\\left(p^{e} v+y\\right)-y \\\\ & =p^{e}(v+y u \\cdot r)+p^{2 e}(\\ldots) \\end{aligned} $$ By selecting $r$ with $r \\equiv-v / u(\\bmod p)$, we ensure $p^{e+1} \\mid x^{k r+m}-y$, hence $\\ell=k r+m$ is as desired. $$ x^{\\ell-m} \\equiv 1 \\quad\\left(\\bmod p^{e}\\right) \\text { but } x^{\\ell-m} \\not \\equiv 1 \\quad\\left(\\bmod p^{e+1}\\right) $$ In particular, we need $\\nu_{p}\\left(x^{\\ell-m}-1\\right)=e$ exactly. So the $k$ in the claim must exist if we are going to succeed. On the other hand, if $k$ is some integer for which $\\nu_{p}\\left(x^{k}-1\\right)=e$, then by choosing $\\ell-m$ to be some multiple of $k$ with no extra factors of $p$, we hope that we can get $\\nu_{p}\\left(x^{\\ell}-y\\right)=e+1$. That's why we write $\\ell=k r+m$ and see what happens when we expand.", "metadata": {"resource_path": "USA_TSTST/segmented/en-sols-TSTST-2014.jsonl"}}