Navvye/Olympiad-Problems-CSV huggingface dataset:
Problem: The positive integers $N$ and $N^2$ both end in the same sequence of four digits $abcd$ when written in base $10$ , where digit $a$ is not zero. Find the three-digit number $abc$

Solution: let $N= 10000t+1000a+100b+10c+d$ for positive integer values $t,a,b,c,d$ .
When we square $N$ we get that \begin{align*} N^2 &=(10000t+1000a+100b+10c+d)^2\\ &=10^8t^2+10^6a^2+10^4b^2+10^2c^2+d^2+2(10^7ta+10^6tb+10^5tc+10^4td+10^5ab+10^4ac+10^3bc+10^ad+10^2bd+10cd) \end{align*}
However, we don't have to deal with this whole expression but only with its last 4 digits so it is suffices to consider only: \[2000ad+2000bc+100c^2+200bd+20cd+d^2.\] Now we need to compare each decimal digit with $1000a+100b+10c+d$ and see whether the digits are congruent in base 10.
we first consider the ones digits:
$d^2\equiv d \pmod{10}.$
This can happen for only 3 values : 1, 5 and 6.
We can try to solve each case:
Considering the tenths place, 
we have that:
$20cd=20c\equiv 10c \pmod {100}$ so $c= 0$
Considering the hundreds place we have that
$200bd+100c^2= 200b \equiv 100b \pmod{1000}$ so again $b=0$
now considering the thousands place we have that
$2000ad+2000bc = 2000a \equiv 1000a \pmod {10000}$ so we get $a=0$ but $a$ cannot be equal to $0$ so we consider $d=5.$
considering the tenths place
we have that:
$20cd+20=100c+20\equiv 20 \equiv 10c \mod  {100}$ ( the extra $20$ is carried from $d^2$ which is equal to $25$ )
so $c=2$
considering the hundreds place we have that
$200bd+100c^2+100c= 1000b+600 \equiv600\equiv 100b \pmod{1000}$ ( the extra $100c$ is carried from the tenths place)
so $b=6$
now considering the thousands place we have that
$2000ad+2000bc +1000b= 10000a+24000+ 6000\equiv0\equiv 1000a \pmod {10000}$ ( the extra $1000b$ is carried from the hundreds place)
so a is equal 0 again
considering the tenths place
we have that:
$20cd+30=120c+30\equiv 30+20c \equiv 10c \pmod {100}$ ( the extra $20$ is carried from $d^2$ which is equal to $25$ )
if $c=7$ then we have
$30+20 \cdot 7 \equiv 70\equiv7 \cdot 10 \pmod{100}$
so $c=7$
considering the hundreds place we have that
$200bd+100c^2+100c+100= 1200b+4900+800 \equiv200b+700\equiv 100b \pmod{1000}$ ( the extra $100c+100$ is carried from the tenths place)
if $b=3$ then we have
$700+200 \cdot 3 \equiv 300\equiv3 \cdot 100 \pmod {1000}$
so $b=3$
now considering the thousands place we have that
$2000ad+2000bc +1000b+5000+1000= 12000a+42000+ 3000+6000\equiv0\equiv 2000a+1000\equiv 1000a \pmod {10000}$ ( the extra $1000b+6000$ is carried from the hundreds place)
if $a=9$ then we have
$2000 \cdot 9+1000 \equiv 9000\equiv9 \cdot 1000 \pmod {1000}$
so $a=9$
so we have that the last 4 digits of $N$ are $9376$ and $abc$ is equal to $\boxed{937}$

Answer:  937
Problem: The positive integers $N$ and $N^2$ both end in the same sequence of four digits $abcd$ when written in base $10$ , where digit $a$ is not zero. Find the three-digit number $abc$

Solution: By the Chinese Remainder Theorem, the equation $N(N-1)\equiv 0\pmod{10000}$ is equivalent to the two equations: \begin{align*} N(N-1)&\equiv 0\pmod{16},\\ N(N-1)&\equiv 0\pmod{625}. \end{align*} Since $N$ and $N-1$ are coprime, the only solutions are when $(N\mod{16},N\mod{625})\in\{(0,0),(0,1),(1,0),(1,1)\}$
Let \[\varphi:\mathbb Z/10000\mathbb Z\to\mathbb Z/16\mathbb Z\times\mathbb Z/625\mathbb Z,\] \[x\mapsto (x\mod{16},x\mod{625}).\] The statement of the Chinese Remainder theorem is that $\varphi$ is an isomorphism between the two rings. In this language, the solutions are $\varphi^{-1}(0,0)$ $\varphi^{-1}(0,1)$ $\varphi^{-1}(1,0)$ , and $\varphi^{-1}(1,1)$ . Now we easily see that \[\varphi^{-1}(0,0)=0\] and \[\varphi^{-1}(1,1)=1.\] Noting that $625\equiv 1\pmod{16}$ , it follows that \[\varphi^{-1}(1,0)=625.\] To compute $\varphi^{-1}(0,1)$ , note that \[(0,1)=15(1,0)+(1,1)\] in \[\mathbb Z/16\mathbb Z\times\mathbb Z/625\mathbb Z,\] so since $\varphi^{-1}$ is linear in its arguments (by virtue of being an isomorphism), \[\varphi^{-1}(0,1)=15\varphi^{-1}(1,0)+\varphi^{-1}(1,1)=15\times 625+1=9376.\]
The four candidate digit strings $abcd$ are then $0000,0001,0625,9376$ . Of those, only $9376$ has nonzero first digit, and therefore the answer is $\boxed{937}$

Answer:  937
Problem: Let $x_1<x_2<x_3$ be the three real roots of the equation $\sqrt{2014}x^3-4029x^2+2=0$ . Find $x_2(x_1+x_3)$

Solution: Substituting $n$ for $2014$ , we get \[\sqrt{n}x^3 - (1+2n)x^2 + 2 = \sqrt{n}x^3 - x^2 - 2nx^2 + 2\] \[= x^2(\sqrt{n}x - 1) - 2(nx^2 - 1) = 0\] Noting that $nx^2 - 1$ factors as a difference of squares to \[(\sqrt{n}x - 1)(\sqrt{n}x+1)\] we can factor the left side as \[(\sqrt{n}x - 1)(x^2 - 2(\sqrt{n}x+1))\] This means that $\frac{1}{\sqrt{n}}$ is a root, and the other two roots are the roots of $x^2 - 2\sqrt{n}x - 2$ . Note that the constant term of the quadratic is negative, so one of the two roots is positive and the other is negative. In addition, by Vieta's Formulas, the roots sum to $2\sqrt{n}$ , so the positive root must be greater than $2\sqrt{n}$ in order to produce this sum when added to a negative value. Since $0 < \frac{1}{\sqrt{2014}} < 2\sqrt{2014}$ is clearly true, $x_2 = \frac{1}{\sqrt{2014}}$ and $x_1 + x_3 = 2\sqrt{2014}$ . Multiplying these values together, we find that $x_2(x_1+x_3) = \boxed{002}$

Answer:  002
Problem: Let $x_1<x_2<x_3$ be the three real roots of the equation $\sqrt{2014}x^3-4029x^2+2=0$ . Find $x_2(x_1+x_3)$

Solution: From Vieta's formulae, we know that \[x_1x_2x_3 = \dfrac{-2}{\sqrt{2014}}\] \[x_1 + x_2 + x_3 = \dfrac{4029}{\sqrt{2014}}\] and \[x_1x_2 + x_2x_3 + x_1x_3 = 0\] Thus, we know that \[x_2(x_1 + x_3) = -x_1x_3\]
Now consider the polynomial with roots $x_1x_2, x_2x_3,$ and $x_1x_3$ . Expanding the polynomial \[(x - x_1x_2)(x - x_2x_3)(x - x_1x_3)\] we get the polynomial \[x^3 - (x_1x_2 + x_2x_3 + x_1x_3)x^2 + (x_1x_2x_3)(x_1 + x_2 + x_3)x - (x_1x_2x_3)^2\] Substituting the values obtained from Vieta's formulae, we find that this polynomial is \[x^3 - \dfrac{8058}{2014}x - \dfrac{4}{2014}\] We know $x_1x_3$ is a root of this polynomial, so we set it equal to 0 and simplify the resulting expression to \[1007x^3 - 4029x - 2 = 0\]
Given the problem conditions, we know there must be at least 1 integer solution, and that it can't be very large (because the $x^3$ term quickly gets much larger/smaller than the other 2). Trying out some numbers, we quickly find that $x = -2$ is a solution. Factoring it out, we get that \[1007x^3 - 4029x - 2 = (x+2)(1007x^2 - 2014x - 1)\] Since the other quadratic factor clearly does not have any integer solutions and since the AIME has only positive integer answers, we know that this must be the answer they are looking for. Thus, \[x_1x_3 = -2\] so \[-x_1x_3 = \boxed{002}\] and we're done.

Answer:  002
Problem: Let $x_1<x_2<x_3$ be the three real roots of the equation $\sqrt{2014}x^3-4029x^2+2=0$ . Find $x_2(x_1+x_3)$

Solution: Observing the equation, we notice that the coefficient for the middle term $-4029$ is equal to \[-2{\sqrt{2014}}^2-1\]
Also notice that the coefficient for the ${x^3}$ term is $\sqrt{2014}$ . Therefore, if the original expression was to be factored into a linear binomial and a quadratic trinomial, the $x$ term of the binomial would have a coefficient of $\sqrt{2014}$ . Similarly, the $x$ term of the trinomial would also have a coefficient of $\sqrt{2014}$ . The factored form of the expression would look something like the following: \[({\sqrt{2014}}x-a)(x^2-n{\sqrt{2014}}x-b)\] where ${a, b,c}$ are all positive integers (because the ${x^2}$ term of the original expression is negative, and the constant term is positive), and \[{ab=2}\]
Multiplying this expression out gives \[{{\sqrt{2014}x^3-(2014n+a)x^2+(an{\sqrt{2014}}-b{\sqrt{2014}})x+ab}}\] Equating this with the original expression gives \[{2014n+a}=-4029\] The only positive integer solutions of this expression is $(n, a)=(1, 2015)$ or $(2, 1)$ . If $(n, a)=(1, 2015)$ then setting ${an{\sqrt{2014}}-b{\sqrt{2014}}}=0$ yields ${b=2015}$ and therefore ${ab=2015^2}$ which clearly isn't equal to $2$ as the constant term. Therefore, $(n, a)=(2, 1)$ and the factored form of the expression is: \[({\sqrt{2014}}x-1)(x^2-2{\sqrt{2014}}x-2)\] Therefore, one of the three roots of the original expression is \[{x=\dfrac{1}{\sqrt{2014}}}\] Using the quadratic formula yields the other two roots as \[{x={\sqrt{2014}}+{\sqrt{2016}}}\] and \[{x={\sqrt{2014}}-{\sqrt{2016}}}\] Arranging the roots in ascending order (in the order $x_1<x_2<x_3$ ), \[{\sqrt{2014}}-{\sqrt{2016}}<\dfrac{1}{\sqrt{2014}}<{\sqrt{2014}}+{\sqrt{2016}}\] Therefore, \[x_2(x_1+x_3)=\dfrac{1}{\sqrt{2014}}{2\sqrt{2014}}=\boxed{002}\]

Answer:  002
Problem: Let $x_1<x_2<x_3$ be the three real roots of the equation $\sqrt{2014}x^3-4029x^2+2=0$ . Find $x_2(x_1+x_3)$

Solution: By Vieta's, we are seeking to find $x_2(x_1+x_3)=x_1x_2+x_2x_3=-x_1x_3=\frac{2}{\sqrt{2014}x_2}$ . Substitute $n=-x_1x_3$ and $x_2=\frac{2}{\sqrt{2014}n}$ . Substituting this back into the original equation, we have $\frac{4}{1007n^3}-\frac{8058}{1007n^2}+2=0$ , so $2n^3-\frac{8058}{1007}n+\frac{4}{1007}=2n^3-\frac{8058n-4}{1007}=0$ . Hence, $8058n-4\equiv 2n-4 \equiv 0 \pmod{1007}$ , and $n\equiv 2\pmod{1007}$ . But since $n\le 999$ because it is our desired answer, the only possible value for $n$ is $\boxed{002}$ BEST PROOOFFFF
Stormersyle & mathleticguyyy

Answer:  002
Problem: Let $x_1<x_2<x_3$ be the three real roots of the equation $\sqrt{2014}x^3-4029x^2+2=0$ . Find $x_2(x_1+x_3)$

Solution: Let $x =\frac{y}{\sqrt{2014}}.$ The original equation simplifies to $\frac{y^3}{2014} -\frac{4029y^2}{2014}+2 = 0 \implies y^3 - 4029y^2 + 4028=0.$ Here we clearly see that $y=1$ is a root. Dividing $y-1$ from the sum we find that $(y-1)(y^2-4028y-4028)=0.$ From simple bounding we see that $y=1$ is the middle root. Therefore $x_{2}(x_{1}+x_{3}) =\frac{1}{\sqrt{2014}} \cdot\frac{4028}{\sqrt{2014}} = \boxed{002}.$

Answer:  002
Problem: Let $x_1<x_2<x_3$ be the three real roots of the equation $\sqrt{2014}x^3-4029x^2+2=0$ . Find $x_2(x_1+x_3)$

Solution: We will estimate the roots of the polynomial. (This strategy normally doesn't work on AIME #9, but playing around with a function is often good strategy for getting an intuition for the problem. In this problem, estimation happens to be a valid solution path. It isn't a proof, but given the constraint that the answer is an integer, we can be certain that our answer is correct.)
Let $p(x) = \sqrt{2014}x^3-4029x^2+2=0$ . We start by estimating $p(-1)$ $p(0)$ , and $p(1)$ (A natural first step for function analysis.):
$p(-1)\approx -45-4029+2 \approx -4000$
$p(0) = 2$
$p(1) \approx 45-4029+2 \approx -4000$
We conclude by Intermediate Value Theorem (or just common sense), that there is a root on $(-1, 0)$ and another root on $(0, 1)$
We know that $p(1) < 0$ and that $\lim_{x\to\infty} p(x) = \infty$ . We conclude that the third root is on $(1, \infty)$ . Therefore, $x_1 \in (-1, 0)$ $x_2 \in (0, 1)$ , and $x_3 \in (1, \infty)$
We will estimate $x_3$ . For $x > 1$ , the constant term of $p(x)$ is negligible. We simplify and get $p(x_3) \approx \sqrt{2014}x_{3}^3 - 4029x_{3}^2 = 0$ . Solving for $x_3$ (We can divide by $x_{3}^2$ because we know $x_3 \neq 0$ ), we get $x_3 \approx \frac{4029}{\sqrt{2014}} \approx 2\sqrt{2014} \approx 90$ . We can intuitively bound $x_3$ between $88$ and $92$
We will now estimate $x_1$ and $x_2$ $x_1$ and $x_2$ are close to $0$ . As a result, the $\sqrt{2014}x^3$ term is negligible. We simplify and get $p(x) \approx -4029x^2 + 2 = 0$ . Solving for $x$ , we get $x \approx \pm \sqrt{\frac{2}{4029}} \approx \pm \sqrt{\frac{1}{2014.5}} \approx \pm \frac{1}{45}$ . We can intuitively bound $x_1$ between $-\frac{1}{43}$ and $-\frac{1}{47}$ . Similarly, we can intuitively bound $x_2$ between $\frac{1}{47}$ and $\frac{1}{43}$
We calculate that the minimum possible value of $x_2(x_1 + x_3)$ is $\frac{88-\frac{1}{43}}{47}$ and the maximum possible value is $\frac{92-\frac{1}{47}}{43}$ . The only integer that falls is this range is $\boxed{002}$

Answer:  002
Problem: A disk with radius $1$ is externally tangent to a disk with radius $5$ . Let $A$ be the point where the disks are tangent, $C$ be the center of the smaller disk, and $E$ be the center of the larger disk. While the larger disk remains fixed, the smaller disk is allowed to roll along the outside of the larger disk until the smaller disk has turned through an angle of $360^\circ$ . That is, if the center of the smaller disk has moved to the point $D$ , and the point on the smaller disk that began at $A$ has now moved to point $B$ , then $\overline{AC}$ is parallel to $\overline{BD}$ . Then $\sin^2(\angle BEA)=\tfrac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: [asy] size(150); pair a=(5,0),b=(2,3*sqrt(3)),c=(6,0),d=(3,3*sqrt(3)),e=(0,0); draw(circle(e,5)); draw(circle(c,1)); draw(circle(d,1)); dot(a^^b^^c^^d^^e^^(5/2,5*sqrt(3)/2)); label("$A$",a,W,fontsize(9)); label("$B$",b,NW,fontsize(9)); label("$C$",c,E,fontsize(9)); label("$D$",d,E,fontsize(9)); label("$E$",e,SW,fontsize(9)); label("$F$",(5/2,5*sqrt(3)/2),SSW,fontsize(9)); [/asy]
Let $F$ be the new tangency point of the two disks. The smaller disk rolled along minor arc $\overarc{AF}$ on the larger disk.
Let $\alpha = \angle AEF$ , in radians. The smaller disk must then have rolled along an arc of length $5\alpha$ , since the larger disk has a radius of $5$ .  Since all of the points on major arc $\overarc{BF}$ on the smaller disk have come into contact with the larger disk at some point during the rolling, and none of the other points on the smaller disk did, \[\overarc{BF}=\overarc{AF}=5\alpha\]
Since $\overline{AC} || \overline{BD}$ \[\angle BDF \cong \angle FEA\] so the angles of minor arc $\overarc{BF}$ and minor arc $\overarc{AF}$ are equal, so minor arc $\overarc{BF}$ has an angle of $\alpha$ . Since the smaller disk has a radius of $1$ , the length of minor arc $\overarc{BF}$ is $\alpha$ . This means that $5\alpha + \alpha$ equals the circumference of the smaller disk, so $6\alpha = 2\pi$ , or $\alpha = \frac{\pi}{3}$
Now, to find $\sin^2{\angle BEA}$ , we construct $\triangle BDE$ . Also, drop a perpendicular from $D$ to $\overline{EA}$ , and call this point $X$ . Since $\alpha = \frac{\pi}{3}$ and $\angle DXE$ is right, \[DE = 6\] \[EX = 3\] and \[DX = 3\sqrt{3}\]
Now drop a perpendicular from $B$ to $\overline{EA}$ , and call this point $Y$ . Since $\overline{BD} || \overline{EA}$ \[XY = BD = 1\] and \[BY = DX = 3\sqrt{3}\] Thus, we know that \[EY = EX - XY = 3 - 1 = 2\] and by using the Pythagorean Theorem on $\triangle BEY$ , we get that \[BE = \sqrt{31}\] Thus, \[\sin{\angle BEA} = \frac{\sqrt{27}}{\sqrt{31}}\] so \[\sin^2{\angle BEA} = \frac{27}{31}\] and our answer is $27 + 31 = \boxed{058}$

Answer:  058
Problem: A disk with radius $1$ is externally tangent to a disk with radius $5$ . Let $A$ be the point where the disks are tangent, $C$ be the center of the smaller disk, and $E$ be the center of the larger disk. While the larger disk remains fixed, the smaller disk is allowed to roll along the outside of the larger disk until the smaller disk has turned through an angle of $360^\circ$ . That is, if the center of the smaller disk has moved to the point $D$ , and the point on the smaller disk that began at $A$ has now moved to point $B$ , then $\overline{AC}$ is parallel to $\overline{BD}$ . Then $\sin^2(\angle BEA)=\tfrac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: First, we determine how far the small circle goes. For the small circle to rotate completely around the circumference, it must rotate $5$ times (the circumference of the small circle is $2\pi$ while the larger one has a circumference of $10\pi$ ) plus the extra rotation the circle gets for rotating around the circle, for a total of $6$ times. Therefore, one rotation will bring point $D$ $60^\circ$ from $C$
Now, draw $\triangle DBE$ , and call \[\angle BED = x^{\circ}\] We know that $\overline{ED}$ is 6, and $\overline{BD}$ is 1. Since $EC || BD$ \[\angle BDE = 60^\circ\]
By the Law of Cosines, \[\overline{BE}^2=36+1-2\times 6\times 1\times \cos{60^\circ} = 36+1-6=31\] and since lengths are positive, \[\overline{BE}=\sqrt{31}\]
By the Law of Sines, we know that \[\frac{1}{\sin{x}}=\frac{\sqrt{31}}{\sin{60^\circ}}\] so \[\sin{x} = \frac{\sin{60^\circ}}{\sqrt{31}} = \frac{\sqrt{93}}{62}\] As $x$ is clearly between $0$ and $90^\circ$ $\cos{x}$ is positive. As $\cos{x}=\sqrt{1-\sin^2{x}}$ \[\cos{x} = \frac{11\sqrt{31}}{62}\]
Now we use the angle sum formula to find the sine of $\angle BEA$ \[\sin 60^\circ\cos x + \cos 60^\circ\sin x = \frac{\sqrt{3}}{2}\frac{11\sqrt{31}}{62}+\frac{1}{2}\frac{\sqrt{93}}{62}\] \[= \frac{11\sqrt{93}+\sqrt{93}}{124} = \frac{12\sqrt{93}}{124} = \frac{3\sqrt{93}}{31} = \frac{3\sqrt{31}\sqrt{3}}{31} = \frac{3\sqrt{3}}{\sqrt{31}}\]
Finally, we square this to get \[\frac{9\times 3}{31}=\frac{27}{31}\] so our answer is $27+31=\boxed{058}$

Answer:  058
Problem: A token starts at the point $(0,0)$ of an $xy$ -coordinate grid and then makes a sequence of six moves. Each move is 1 unit in a direction parallel to one of the coordinate axes. Each move is selected randomly from the four possible directions and independently of the other moves. The probability the token ends at a point on the graph of $|y|=|x|$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: Perform the coordinate transformation $(x, y)\rightarrow (x+y, x-y)$ . Then we can see that a movement up, right, left, or down in the old coordinates adds the vectors $\langle 1, -1 \rangle$ $\langle 1, 1 \rangle$ $\langle -1, -1 \rangle$ $\langle -1, 1 \rangle$ respectively. Moreover, the transformation takes the equation $|y| = |x|$ to the union of the x and y axis. Exactly half of the moves go up in the new coordinates, and half of them go down. In order to end up on the x axis, we need to go up thrice and down thrice. The number of possible sequences of up and down moves is the number of permutations of $UUUDDD$ , which is just $\binom63 = 20$ . The probability of any of these sequences happening is $\left(\frac12\right)^6$ . Thus, the probability of ending on the x axis is $\frac{20}{2^6}$ . Similarly, the probability of ending on the y axis is the same.
However, we overcount exactly one case: ending at $(0, 0)$ . Since ending on the x axis and ending on the y axis are independent events, the probability of both is simply $\left(\frac{20}{2^6}\right)^2 = \frac{25}{256}$ . Using PIE, the total probability is $\frac{20}{64} + \frac{20}{64} - \frac{25}{256} = \frac{135}{256}$ , giving an answer of $\boxed{391}$

Answer:  391
Problem: A token starts at the point $(0,0)$ of an $xy$ -coordinate grid and then makes a sequence of six moves. Each move is 1 unit in a direction parallel to one of the coordinate axes. Each move is selected randomly from the four possible directions and independently of the other moves. The probability the token ends at a point on the graph of $|y|=|x|$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: We have 4 possible moves: U, D, R, and L. The total number of paths that could be taken is $4^6$ , or $4096$ . There are 4 possible cases that land along the line $y = x$ $x,y = \pm 1; x,y = \pm 2; x,y = \pm 3;$ or $x = y = 0$ . We will count the number of ways to end up at $(1,1), (2,2),$ and $(3,3)$ , multiply them by 4 to account for the other quadrants, and add this to the number of ways to end up at $(0,0)$
Thus, the total number of ways to end up at $(1,1)$ is $300$
Thus, the total number of ways to end up at $(0,0)$ is $400$
Adding these cases together, we get that the total number of ways to end up on $y = x$ is $4(20 + 120 + 300) + 400 = 2160$ . Thus, our probability is $\frac{2160}{4096}$ . When this fraction is fully reduced, it is $\frac{135}{256}$ , so our answer is $135 + 256 = \boxed{391}.$

Answer:  391
Problem: A token starts at the point $(0,0)$ of an $xy$ -coordinate grid and then makes a sequence of six moves. Each move is 1 unit in a direction parallel to one of the coordinate axes. Each move is selected randomly from the four possible directions and independently of the other moves. The probability the token ends at a point on the graph of $|y|=|x|$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m+n$

Solution: We split this into cases by making a chart. In each row, the entries $(\pm1)$ before the dividing line represent the right or left steps (without regard to order), and the entries after the dividing line represent the up or down steps (again, without regard to order). This table only represents the cases where the ending position $(x,y)$ satisfies $x=y$ \[\begin{array}{ccccccccccccl} \multicolumn{5}{c}{R (+)\qquad L (-)}& |&\multicolumn{5}{c}{U (+)\qquad D (-)}\\ +1&&  +1&&  +1&| &  +1&&  +1&&  +1\\ +1&& +1&& -1& | & +1&& +1&& -1\\ +1&& -1&&  -1& | & +1&& -1&& -1\\ -1 && -1&&  -1& |  & -1&&  -1&& -1\\ \\ +1&& +1&& +1&& -1 &|& +1&& +1\\ +1&& +1&& -1 && -1 &|& +1 && -1\\ +1&& -1&&  -1 && -1 &|& -1 &&  -1 &&(\times 2 \text{ for symmetry by swapping }R-L\text{ and }U-D)\\ \\ +1&& +1 &&+1 &&-1&& -1& |& +1\\ +1&& +1 &&-1&&  -1&& -1 &|& -1&& (\times 2\text{ symmetry})\\ \\ +1&& +1 &&+1&& -1&& -1 &&-1&| & (\times2 \text{ symmetry})\\ \end{array}\] Note that to account for the cases when $x=-y$ , we can simply multiply the $U-D$ steps by $-1$ , so for example, the first row would become \[+1 \qquad+1\qquad +1 \ \ \ \ |\ \ \  -1\qquad -1\qquad -1.\] Therefore, we must multiply the number of possibilities in each case by $2$ , except for when $x=y=0$
Now, we compute the number of possibilities for each case. In particular, we must compute the number of $RLUD$ words, where $R$ represents $+1$ to the left of $|$ $L$ represents $-1$ to the left of $|$ $U$ represents $+1$ to the right of $|$ , and $D$ represents $-1$ to the right of $|$ . Using multinomials, we compute the following numbers of possibilities for each case. \[{6\choose 3}\cdot  2+ \frac{6!}{2!2!}\cdot 2 + \frac{6!}{2!2!} \cdot 2 + {6\choose 3} \cdot 2 = 2(20 + 180 + 180 + 20) = 800\] \[\frac{6!}{3!2!}\cdot 2 + \frac{6!}{2!2!} + \frac{6!}{3!2!}\cdot 2 = 120 + 180 + 120 = 420\  (\times2\text{ for symmetry})\] \[\frac{6!}{3!2!} \cdot 2 + \frac{6!}{3!2!} \cdot 2 = 120 + 120 = 240\  (\times2\text{ for symmetry})\] \[{6\choose 3} = 20\ (\times 2\text{ for symmetry})\]
Thus, there are $800 + 840 + 480 + 40 = 2160$ possibilities where $|x|=|y|$ . Because there are $4^6$ total possibilities, the probability is $\frac{2160}{4^6} = \frac{135}{256}$ , so the answer is $\boxed{391}.$

Answer:  391