Navvye/Olympiad-Problems-CSV huggingface dataset:
Problem: In triangle $ABC$ $BC = 23$ $CA = 27$ , and $AB = 30$ . Points $V$ and $W$ are on $\overline{AC}$ with $V$ on $\overline{AW}$ , points $X$ and $Y$ are on $\overline{BC}$ with $X$ on $\overline{CY}$ , and points $Z$ and $U$ are on $\overline{AB}$ with $Z$ on $\overline{BU}$ . In addition, the points are positioned so that $\overline{UV}\parallel\overline{BC}$ $\overline{WX}\parallel\overline{AB}$ , and $\overline{YZ}\parallel\overline{CA}$ . Right angle folds are then made along $\overline{UV}$ $\overline{WX}$ , and $\overline{YZ}$ . The resulting figure is placed on a leveled floor to make a table with triangular legs. Let $h$ be the maximum possible height of a table constructed from triangle $ABC$ whose top is parallel to the floor. Then $h$ can be written in the form $\frac{k\sqrt{m}}{n}$ , where $k$ and $n$ are relatively prime positive integers and $m$ is a positive integer that is not divisible by the square of any prime. Find $k+m+n$

Solution: Note that triangles $\triangle AUV, \triangle BYZ$ and $\triangle CWX$ all have the same height because when they are folded up to create the legs of the table, the top needs to be parallel to the floor. We want to find the maximum possible value of this height, given that no two of $\overline{UV}, \overline{WX}$ and $\overline{YZ}$ intersect inside $\triangle ABC$ . Let $h_{A}$ denote the length of the altitude dropped from vertex $A,$ and define $h_{B}$ and $h_{C}$ similarly. Also let $\{u, v, w, x, y, z\} = \{AU, AV, CW, CX, BY, BZ\}$ . Then by similar triangles \begin{align} \frac{u}{AB}=\frac{v}{AC}=\frac{h}{h_{A}}, \\ \frac{w}{CA}=\frac{x}{CB}=\frac{h}{h_{C}}, \\ \frac{y}{BC}=\frac{z}{BA}=\frac{h}{h_{B}}. \end{align} Since $h_{A}=\frac{2K}{23}$ and similarly for $27$ and $30,$ where $K$ is the area of $\triangle ABC,$ we can write \begin{align} \frac{u}{30}=\frac{v}{27}=\frac{h}{\tfrac{2K}{23}}, \\ \frac{w}{27}=\frac{x}{23}=\frac{h}{\tfrac{2K}{30}}, \\ \frac{y}{23}=\frac{z}{30}=\frac{h}{\tfrac{2K}{27}}. \end{align} and simplifying gives $u=x=\frac{690h}{2K}, v=y=\frac{621h}{2K}, w=z=\frac{810h}{2K}$ . Because no two segments can intersect inside the triangle, we can form the inequalities $v+w\leq 27, x+y\leq 23,$ and $z+u\leq 30$ . That is, all three of the inequalities \begin{align} \frac{621h+810h}{2K}\leq 27, \\ \frac{690h+621h}{2K}\leq 23, \\ \frac{810h+690h}{2K}\leq 30. \end{align} must hold. Dividing both sides of each equation by the RHS, we have \begin{align} \frac{53h}{2K}\leq 1\, \text{since}\, \frac{1431}{27}=53, \\ \frac{57h}{2K}\leq 1\, \text{since}\, \frac{1311}{23}=57, \\ \frac{50h}{2K}\leq 1\, \text{since}\, \frac{1500}{30}=50. \end{align} It is relatively easy to see that $\frac{57h}{2K}\leq 1$ restricts us the most since it cannot hold if the other two do not hold. The largest possible value of $h$ is thus $\frac{2K}{57},$ and note that by Heron's formula the area of $\triangle ABC$ is $20\sqrt{221}$ . Then $\frac{2K}{57}=\frac{40\sqrt{221}}{57},$ and the answer is $40+221+57=261+57=\boxed{318}$

Answer:  318
Problem: In triangle $ABC$ $BC = 23$ $CA = 27$ , and $AB = 30$ . Points $V$ and $W$ are on $\overline{AC}$ with $V$ on $\overline{AW}$ , points $X$ and $Y$ are on $\overline{BC}$ with $X$ on $\overline{CY}$ , and points $Z$ and $U$ are on $\overline{AB}$ with $Z$ on $\overline{BU}$ . In addition, the points are positioned so that $\overline{UV}\parallel\overline{BC}$ $\overline{WX}\parallel\overline{AB}$ , and $\overline{YZ}\parallel\overline{CA}$ . Right angle folds are then made along $\overline{UV}$ $\overline{WX}$ , and $\overline{YZ}$ . The resulting figure is placed on a leveled floor to make a table with triangular legs. Let $h$ be the maximum possible height of a table constructed from triangle $ABC$ whose top is parallel to the floor. Then $h$ can be written in the form $\frac{k\sqrt{m}}{n}$ , where $k$ and $n$ are relatively prime positive integers and $m$ is a positive integer that is not divisible by the square of any prime. Find $k+m+n$

Solution: Note that the area is given by Heron's formula and it is $20\sqrt{221}$ . Let $h_i$ denote the length of the altitude dropped from vertex i. It follows that $h_b = \frac{40\sqrt{221}}{27}, h_c  = \frac{40\sqrt{221}}{30}, h_a = \frac{40\sqrt{221}}{23}$ . From similar triangles we can see that $\frac{27h}{h_a}+\frac{27h}{h_c} \le 27 \rightarrow h \le \frac{h_ah_c}{h_a+h_c}$ . We can see this is true for any combination of a,b,c and thus the minimum of the upper bounds for h yields $h = \frac{40\sqrt{221}}{57} \rightarrow \boxed{318}$

Answer:  318
Problem: In triangle $ABC$ $BC = 23$ $CA = 27$ , and $AB = 30$ . Points $V$ and $W$ are on $\overline{AC}$ with $V$ on $\overline{AW}$ , points $X$ and $Y$ are on $\overline{BC}$ with $X$ on $\overline{CY}$ , and points $Z$ and $U$ are on $\overline{AB}$ with $Z$ on $\overline{BU}$ . In addition, the points are positioned so that $\overline{UV}\parallel\overline{BC}$ $\overline{WX}\parallel\overline{AB}$ , and $\overline{YZ}\parallel\overline{CA}$ . Right angle folds are then made along $\overline{UV}$ $\overline{WX}$ , and $\overline{YZ}$ . The resulting figure is placed on a leveled floor to make a table with triangular legs. Let $h$ be the maximum possible height of a table constructed from triangle $ABC$ whose top is parallel to the floor. Then $h$ can be written in the form $\frac{k\sqrt{m}}{n}$ , where $k$ and $n$ are relatively prime positive integers and $m$ is a positive integer that is not divisible by the square of any prime. Find $k+m+n$

Solution: As from above, we can see that the length of the altitude from A is the longest. Thus the highest table is formed when X and Y meet up. Let the distance of this point from B be $x$ , making the distance from C $23 - x$ . Let $h$ be the height of the table. From similar triangles, we have $\frac{x}{23} = \frac{h}{h_b} = \frac{27h}{2A}$ where A is the area of ABC. Similarly, $\frac{23-x}{23}=\frac{h}{h_c}=\frac{30h}{2A}$ . Therefore, $1-\frac{x}{23}=\frac{30h}{2A} \rightarrow1-\frac{27h}{2A}=\frac{30h}{2A}$ and hence $h = \frac{2A}{57} = \frac{40\sqrt{221}}{57}\rightarrow \boxed{318}$

Answer:  318
Problem: Suppose $x$ is in the interval $[0, \pi/2]$ and $\log_{24\sin x} (24\cos x)=\frac{3}{2}$ . Find $24\cot^2 x$

Solution: We can rewrite the given expression as \[\sqrt{24^3\sin^3 x}=24\cos x\] Square both sides and divide by $24^2$ to get \[24\sin ^3 x=\cos ^2 x\] Rewrite $\cos ^2 x$ as $1-\sin ^2 x$ \[24\sin ^3 x=1-\sin ^2 x\] \[24\sin ^3 x+\sin ^2 x - 1=0\] Testing values using the rational root theorem gives $\sin x=\frac{1}{3}$ as a root, $\sin^{-1} \frac{1}{3}$ does fall in the first quadrant so it satisfies the interval. 
There are now two ways to finish this problem.
First way: Since $\sin x=\frac{1}{3}$ , we have \[\sin ^2 x=\frac{1}{9}\] Using the Pythagorean Identity gives us $\cos ^2 x=\frac{8}{9}$ . Then we use the definition of $\cot ^2 x$ to compute our final answer. $24\cot ^2 x=24\frac{\cos ^2 x}{\sin ^2 x}=24\left(\frac{\frac{8}{9}}{\frac{1}{9}}\right)=24(8)=\boxed{192}$

Answer:  192
Problem: Suppose $x$ is in the interval $[0, \pi/2]$ and $\log_{24\sin x} (24\cos x)=\frac{3}{2}$ . Find $24\cot^2 x$

Solution: Like Solution 1, we can rewrite the given expression as \[24\sin^3x=\cos^2x\] Divide both sides by $\sin^3x$ \[24 = \cot^2x\csc x\] Square both sides. \[576 = \cot^4x\csc^2x\] Substitute the identity $\csc^2x = \cot^2x + 1$ \[576 = \cot^4x(\cot^2x + 1)\] Let $a = \cot^2x$ . Then \[576 = a^3 + a^2\] .
Since $\sqrt[3]{576} \approx 8$ , we can easily see that $a = 8$ is a solution. Thus, the answer is $24\cot^2x = 24a = 24 \cdot 8 = \boxed{192}$

Answer:  192
Problem: The probability that a set of three distinct vertices chosen at random from among the vertices of a regular n-gon determine an obtuse triangle is $\frac{93}{125}$ . Find the sum of all possible values of $n$

Solution: Inscribe the regular polygon inside a circle. A triangle inside this circle will be obtuse if and only if its three vertices lie on one side of a diameter of the circle. (This is because if an inscribed angle on a circle is obtuse, the arc it spans must be 180 degrees or greater).
Break up the problem into two cases: an even number of sides $2n$ , or an odd number of sides $2n-1$ . For polygons with $2n$ sides, the circumdiameter has endpoints on $2$ vertices. There are $n-1$ points on one side of a diameter, plus $1$ of the endpoints of the diameter for a total of $n$ points. For polygons with $2n - 1$ points, the circumdiameter has $1$ endpoint on a vertex and $1$ endpoint on the midpoint of the opposite side. There are also $n - 1$ points on one side of the diameter, plus the vertex for a total of $n$ points on one side of the diameter.
Case 1: $2n$ -sided polygon. There are clearly $\binom{2n}{3}$ different triangles total. To find triangles that meet the criteria, choose the left-most point. There are obviously $2n$ choices for this point. From there, the other two points must be within the $n-1$ points remaining on the same side of the diameter. So our desired probability is $\frac{2n\binom{n-1}{2}}{\binom{2n}{3}}$ $=\frac{n(n-1)(n-2)}{\frac{2n(2n-1)(2n-2)}{6}}$ $=\frac{6n(n-1)(n-2)}{2n(2n-1)(2n-2)}$ $=\frac{3(n-2)}{2(2n-1)}$
so $\frac{93}{125}=\frac{3(n-2)}{2(2n-1)}$
$186(2n-1)=375(n-2)$
$372n-186=375n-750$
$3n=564$
$n=188$ and so the polygon has $376$ sides.
Case 2: $2n-1$ -sided polygon. Similarly, $\binom{2n-1}{3}$ total triangles. Again choose the leftmost point, with $2n-1$ choices. For the other two points, there are again $\binom{n-1}{2}$ possibilities.
The probability is $\frac{(2n-1)\binom{n-1}{2}}{\binom{2n-1}{3}}$
$=\frac{3(2n-1)(n-1)(n-2)}{(2n-1)(2n-2)(2n-3)}$
$=\frac{3(n-2)}{2(2n-3)}$
so $\frac{93}{125}=\frac{3(n-2)}{2(2n-3)}$
$186(2n-3)=375(n-2)$
$375n-750=372n-558$
$3n=192$
$n=64$ and our polygon has $127$ sides.
Adding, $127+376=\boxed{503}$

Answer:  503
Problem: The probability that a set of three distinct vertices chosen at random from among the vertices of a regular n-gon determine an obtuse triangle is $\frac{93}{125}$ . Find the sum of all possible values of $n$

Solution: We use casework on the locations of the vertices, if we choose the locations of vertices $v_a, v_b, v_c$ on the n-gon (where the vertices of the n-gon are $v_0, v_1, v_2, ... v_{n-1},$ in clockwise order) to be the vertices of triangle ABC, in order, with the restriction that $a<b<c$
By symmetry, we can assume W/O LOG that the location of vertex A is vertex $v_0$
Now, vertex B can be any of $v_1, v_2, ... v_{n-2}$ .  We start in on casework.
Case 1: vertex B is at one of the locations $v_{n-2}, v_{n-3}, ... v_{\lfloor n/2 \rfloor +1}$ . (The ceiling function is necessary for the cases in which n is odd.)
Now, since the clockwise arc from A to B measures more than 180 degrees; for every location of vertex C we can choose in the above restrictions, angle C will be an obtuse angle.
There are $\lceil n/2 \rceil - 2$ choices for vertex B now (again, the ceiling function is necessary to satisfy both odd and even cases of n).  If vertex B is placed at $v_m$ , there are $n - m - 1$ possible places for vertex C.
Summing over all these possibilities, we obtain that the number of obtuse triangles obtainable from this case is $\frac{(n- \lceil n/2 \rceil - 2)(n - \lceil n/2 \rceil) - 1}{2}$
Case 2: vertex B is at one of the locations not covered in the first case.
Note that this will result in the same number of obtuse triangles as case 1, but multiplied by 2.  This is because fixing vertex B in $v_0$ , then counting up the cases for vertices C, and again for vertices C and A, respectively, is combinatorially equivalent to fixing vertex A at $v_0$ , then counting cases for vertex B, as every triangle obtained in this way can be rotated in the n-gon to place vertex A at $v_0$ , and will not be congruent to any obtuse triangle obtained in case 1, as there will be a different side opposite the obtuse angle in this case.
Therefore, there are $\frac{3(n- \lceil n/2 \rceil - 2)(n - \lceil n/2 \rceil - 1)}{2}$ total obtuse triangles obtainable.
The total number of triangles obtainable is $1+2+3+...+(n-2) = \frac{(n-2)(n-1)}{2}$
The ratio of obtuse triangles obtainable to all triangles obtainable is therefore
$\frac{\frac{3(n- \lceil n/2 \rceil - 2)(n - \lceil n/2 \rceil - 1)}{2}}{\frac{(n-2)(n-1)}{2}} = \frac{3(n- \lceil n/2 \rceil - 2)(n - \lceil n/2 \rceil - 1)}{(n-2)(n-1)}  = \frac{93}{125}$
So, $\frac{(n- \lceil n/2 \rceil - 2)(n - \lceil n/2 \rceil - 1)}{(n-2)(n-1)}  = \frac{31}{125}$
Now, we have that $(n-2)(n-1)$ is divisible by $125 = 5^3$ .  It is now much easier to perform trial-and-error on possible values of n, because we see that $n \equiv 1,2 \pmod{125}$
We find that $n = 127$ and $n = 376$ both work, so the final answer is $127 + 376 = \boxed{503}$

Answer:  503
Problem: Let $R$ be the set of all possible remainders when a number of the form $2^n$ $n$ a nonnegative integer, is divided by 1000. Let $S$ be the sum of the elements in $R$ . Find the remainder when $S$ is divided by 1000.

Solution: Obviously, $2^i$ will have to repeat at some point, and our goal is just to find when it repeats. Suppose $2^a$ is the first time the powers of 2 repeat mod 1000, and that it is the same as $2^b$ where $b < a.$ We have \[2^a \equiv 2^b \mod 1000 \rightarrow 2^a - 2^b \equiv 0 \mod 1000\] We can factor out a $2^b$ to get \[2^b\left(2^{a-b} - 1\right) \equiv 0 \mod 1000\] Now, let's apply CRT. Obviously, if it is 0 mod 1000, this means directly that it is 0 mod 8 and 0 mod 125. Since $2^{a-b} - 1$ has to be odd, this necessarily means $b \ge 3$ for $8 \div 2^b.$ This means that 125 has to divide $2^{a-b} - 1.$ We wish to find the minimum $a - b$ such that this is true, or similarly, we just wish to find $\text{ord}_{125}(2).$ Note that by Euler's Totient Theorem, that $2^{100} \equiv 1 \mod 125.$ After checking, and seeing that $2^{50} \equiv -1 \mod 125$ , this directly means that $\text{ord}_{125}(2) = 100$ or $a - b = 100.$ Since $b \ge 3$ , the smallest $(a, b)$ pair is $(103, 3).$ What this really means is that the sequence of remainders will start repeating at $2^{103}$ or namely that $\{2^0, 2^1, ..., 2^{102}\}$ are all distinct residues mod 1000. Adding these yields \[2^{103} - 1 \equiv 8 - 1 \equiv \boxed{7} \mod 1000\]

Answer:  7
Problem: Let $R$ be the set of all possible remainders when a number of the form $2^n$ $n$ a nonnegative integer, is divided by 1000. Let $S$ be the sum of the elements in $R$ . Find the remainder when $S$ is divided by 1000.

Solution: If we write out the remainders when powers of $2$ are divided by $1000$ , we must eventually write a number we have already written down. After this happens, we will fall into a cycle, and thus, nothing new will be written down.
The answer extraction of the problem is equivalent to asking for $1+2+4 + \dots + 2^n \pmod{1000}$ , where $2^{n+1}$ is the first number whose remainder when divided by $1000$ is a repeat. This expression is equivalent to $2^{n+1}-1 \pmod{1000}$ . So our answer will just be the first repeated remainder minus $1$
(Everything up to this point has been perfectly rigorous; now, we will destroy this.)
Note that $1$ $2$ and $4$ cannot be the first repeated remainders, due to the $2$ $4$ and $8$ divisibility rules, respectively (i.e. $2^0$ $2^1$ and $2^2$ are the only powers of $2$ that leave a remainder of $1$ $2$ and $4$ , respectively, when divided by $1000$ .) There is no reason why $8$ could not be the first repeated remainder, so it probably is. Thus, our answer is $8-1 = \boxed{7}$ . (In fact, one can quite easily show that if $8$ reappears at all in the sequence, it must be the first repeated remainder.)

Answer:  7
Problem: Six men and some number of women stand in a line in random order. Let $p$ be the probability that a group of at least four men stand together in the line, given that every man stands next to at least one other man. Find the least number of women in the line such that $p$ does not exceed 1 percent.

Solution: Let $n$ be the number of women present, and let _ be some positive number of women between groups of men.  Since the problem states that every man stands next to another man, there cannot be isolated men.  Thus, there are five cases to consider, where $(k)$ refers to a consecutive group of $k$ men:
For the first case, we can place the three groups of men in between women.  We can think of the groups of men as dividers splitting up the $n$ women.  Since there are $n+1$ possible places to insert the dividers, and we need to choose any three of these locations, we have $\dbinom{n+1}{3}$ ways.
The second, third, and fourth cases are like the first, only that we need to insert two dividers among the $n+1$ possible locations.  Each gives us $\dbinom{n+1}{2}$ ways, for a total of $3\dbinom{n+1}{2}$ ways.
The last case gives us $\dbinom{n+1}{1}=n+1$ ways.
Therefore, the total number of possible ways where there are no isolated men is
\[\dbinom{n+1}{3}+3\dbinom{n+1}{2}+(n+1).\]
The total number of ways where there is a group of at least four men together is the sum of the third, fourth, and fifth case, or
\[2\dbinom{n+1}{2}+(n+1).\]
Thus, we want to find the minimum possible value of $n$ where $n$ is a positive integer such that
\[\dfrac{2\dbinom{n+1}{2}+(n+1)}{\dbinom{n+1}{3}+3\dbinom{n+1}{2}+(n+1)}\le\dfrac{1}{100}.\]
After simplification, we arrive at \[\dfrac{6(n+1)}{n^2+8n+6}\le\dfrac{1}{100}.\]
Simplifying again, we see that we seek the smallest positive integer value of $n$ such that $n(n-592)\ge594$ . Clearly $n>592$ , or the left side will not even be positive; we quickly see that $n=593$ is too small but $n=\boxed{594}$ satisfies the inequality.

Answer:  594
Problem: A cube with side length 10 is suspended above a plane. The vertex closest to the plane is labeled $A$ . The three vertices adjacent to vertex $A$ are at heights 10, 11, and 12 above the plane. The distance from vertex $A$ to the plane can be expressed as $\frac{r-\sqrt{s}}{t}$ , where $r$ $s$ , and $t$ are positive integers. Find $r+s+t$

Solution: Set the cube at the origin with the three vertices along the axes and the plane equal to $ax+by+cz+d=0$ , where $a^2+b^2+c^2=1$ .  The distance from a point $(X,Y,Z)$ to a plane with equation $Ax+By+Cz+D=0$ is \[\frac{AX+BY+CZ+D}{\sqrt{A^2+B^2+C^2}},\] so the (directed) distance from any point $(x,y,z)$ to the plane is $ax+by+cz+d$ .  So, by looking at the three vertices, we have $10a+d=10, 10b+d=11, 10c+d=12$ , and by rearranging and summing, \[(10-d)^2+(11-d)^2+(12-d)^2= 100\cdot(a^2+b^2+c^2)=100.\]
Solving the equation is easier if we substitute $11-d=y$ , to get $3y^2+2=100$ , or $y=\sqrt {98/3}$ .  The distance from the origin to the plane is simply $d$ , which is equal to $11-\sqrt{98/3} =(33-\sqrt{294})/3$ , so $33+294+3=\boxed{330}$

Answer:  330
Problem: A cube with side length 10 is suspended above a plane. The vertex closest to the plane is labeled $A$ . The three vertices adjacent to vertex $A$ are at heights 10, 11, and 12 above the plane. The distance from vertex $A$ to the plane can be expressed as $\frac{r-\sqrt{s}}{t}$ , where $r$ $s$ , and $t$ are positive integers. Find $r+s+t$

Solution: Let the vertices with distance $10,11,12$ be $B,C,D$ , respectively. An equilateral triangle $\triangle BCD$ is formed with side length $10\sqrt{2}$ . We care only about the $z$ coordinate: $B=10,C=11,D=12$ . It is well known that the centroid of a triangle is the average of the coordinates of its three vertices, so $\text{centroid}=(10+11+12)/3=11$ . Designate the midpoint of $BD$ as $M$ . Notice that median $CM$ is parallel to the plane because the $\text{centroid}$ and vertex $C$ have the same $z$ coordinate, $11$ , and the median contains $C$ and the $\text{centroid}$ . We seek the angle $\theta$ of the line: $(1)$ through the centroid $(2)$ perpendicular to the plane formed by $\triangle BCD$ $(3)$ with the plane under the cube. Since the median is parallel to the plane, this orthogonal line is also perpendicular $\textit{in slope}$ to $BD$ . Since $BD$ makes a $2-14-10\sqrt{2}$ right triangle, the orthogonal line makes the same right triangle rotated $90^\circ$ . Therefore, $\sin\theta=\frac{14}{10\sqrt{2}}=\frac{7\sqrt{2}}{10}$
It is also known that the centroid of $\triangle BCD$ is a third of the way between vertex $A$ and $H$ , the vertex farthest from the plane. Since $AH$ is a diagonal of the cube, $AH=10\sqrt{3}$ . So the distance from the $\text{centroid}$ to $A$ is $10/\sqrt{3}$ . So, the $\Delta z$ from $A$ to the centroid is $\frac{10}{\sqrt{3}}\sin\theta=\frac{10}{\sqrt{3}}\left(\frac{7\sqrt{2}}{10}\right)=\frac{7\sqrt{6}}{3}$
Thus the distance from $A$ to the plane is $11-\frac{7\sqrt{6}}{3}=\frac{33-7\sqrt{6}}{3}=\frac{33-\sqrt{294}}{3}$ , and $33+294+3=\boxed{330}$

Answer:  330
Problem: Let $A_1 A_2 A_3 A_4 A_5 A_6 A_7 A_8$ be a regular octagon.  Let $M_1$ $M_3$ $M_5$ , and $M_7$ be the midpoints of sides $\overline{A_1 A_2}$ $\overline{A_3 A_4}$ $\overline{A_5 A_6}$ , and $\overline{A_7 A_8}$ , respectively.  For $i = 1, 3, 5, 7$ , ray $R_i$ is constructed from $M_i$ towards the interior of the octagon such that $R_1 \perp R_3$ $R_3 \perp R_5$ $R_5 \perp R_7$ , and $R_7 \perp R_1$ .  Pairs of rays $R_1$ and $R_3$ $R_3$ and $R_5$ $R_5$ and $R_7$ , and $R_7$ and $R_1$ meet at $B_1$ $B_3$ $B_5$ $B_7$ respectively.  If $B_1 B_3 = A_1 A_2$ , then $\cos 2 \angle A_3 M_3 B_1$ can be written in the form $m - \sqrt{n}$ , where $m$ and $n$ are positive integers.  Find $m + n$

Solution: We use coordinates. Let the octagon have side length $2$ and center $(0, 0)$ . Then all of its vertices have the form $(\pm 1, \pm\left(1+\sqrt{2}\right))$ or $(\pm\left(1+\sqrt{2}\right), \pm 1)$
By symmetry, $B_{1}B_{3}B_{5}B_{7}$ is a square. Thus lines $\overleftrightarrow{B_{1}B_{3}}$ and $\overleftrightarrow{B_{5}B_{7}}$ are parallel, and its side length is the distance between these two lines. However, this is given to be the side length of the octagon, or $2$
Suppose the common slope of the lines is $m$ and let $m=\tan\theta$ . Then, we want to find \[\cos 2\left(90-\theta\right)=2\cos^{2}\left(90-\theta\right)-1=2\sin^{2}\theta-1.\]
It can easily be seen that the equations of the lines are \begin{align*} B_{1}B_{3}: y-mx+m\left(1+\sqrt{2}\right)=0 \\ B_{5}B_{7}: y-mx-m\left(1+\sqrt{2}\right)=0.\end{align*} By the distance between parallel lines formula , a corollary of the point to line distance formula , the distance between these two lines is \[\frac{|c_{2}-c_{1}|}{\sqrt{a^{2}+b^{2}}}=\frac{2m\left(1+\sqrt{2}\right)}{\sqrt{m^{2}+1}}.\] Since we want this to equal $2$ , we have \begin{align*}\frac{2m\left(1+\sqrt{2}\right)}{\sqrt{m^{2}+1}}&=2 \\ 4m^{2}\left(3+2\sqrt{2}\right)&=4m^{2}+4 \\ \left(12+8\sqrt{2}\right)m^{2}&=4m^{2}+4 \\ \left(8+8\sqrt{2}\right)m^{2}&=4 \\ m^{2}&=\frac{4}{8+8\sqrt{2}} \\ \Rightarrow m^{2}=\tan^{2}\theta=\frac{\sin^{2}\theta}{\cos^{2}\theta}&=\frac{1}{2+2\sqrt{2}}.\end{align*} Since $\sin^{2}\theta+\cos^{2}\theta=1,$ we have $\sin^{2}\theta=\frac{1}{3+2\sqrt{2}}$ . Thus \[2\sin^{2}\theta-1=\frac{2}{3+2\sqrt{2}}-1=\frac{-1-2\sqrt{2}}{3+2\sqrt{2}}=\frac{\left(-1-2\sqrt{2}\right)\left(3-2\sqrt{2}\right)}{\left(3+2\sqrt{2}\right)\left(3-2\sqrt{2}\right)}=\frac{5-4\sqrt{2}}{1}=5-\sqrt{32}.\] The answer is $\boxed{037}$

Answer:  037