Navvye/Olympiad-Problems-CSV huggingface dataset:
Problem: Square $S_{1}$ is $1\times 1.$ For $i\ge 1,$ the lengths of the sides of square $S_{i+1}$ are half the lengths of the sides of square $S_{i},$ two adjacent sides of square $S_{i}$ are perpendicular bisectors of two adjacent sides of square $S_{i+1},$ and the other two sides of square $S_{i+1},$ are the perpendicular bisectors of two adjacent sides of square $S_{i+2}.$ The total area enclosed by at least one of $S_{1}, S_{2}, S_{3}, S_{4}, S_{5}$ can be written in the form $m/n,$ where $m$ and $n$ are relatively prime positive integers.  Find $m-n.$
AIME 1995 Problem 1.png

Solution: The sum of the areas of the squares if they were not interconnected is a geometric sequence
Then subtract the areas of the intersections, which is $\left(\frac{1}{4}\right)^2 + \ldots + \left(\frac{1}{32}\right)^2$
The majority of the terms cancel, leaving $1 + \frac{1}{4} - \frac{1}{1024}$ , which simplifies down to $\frac{1024 + \left(256 - 1\right)}{1024}$ . Thus, $m-n =  \boxed{255}$

Answer:  255
Problem: Find the last three digits of the product of the positive roots of $\sqrt{1995}x^{\log_{1995}x}=x^2$

Solution: Instead of taking $\log_{1995}$ , we take $\log_x$ of both sides and simplify:
$\log_x(\sqrt{1995}x^{\log_{1995}x})=\log_x(x^{2})$
$\log_x\sqrt{1995}+\log_x x^{\log_{1995}x}=2$
$\dfrac{1}{2} \log_x 1995 + \log_{1995} x = 2$
We know that $\log_x 1995$ and $\log_{1995} x$ are reciprocals, so let $a=\log_{1995} x$ .  Then we have $\dfrac{1}{2}\left(\dfrac{1}{a}\right) + a = 2$ .  Multiplying by $2a$ and simplifying gives us $2a^2-4a+1=0$ , as shown above.
Because $a=\log_{1995} x$ $x=1995^a$ . By the quadratic formula, the two roots of our equation are $a=\frac{2\pm\sqrt2}{2}$ . This means our two roots in terms of $x$ are $1995^\frac{2+\sqrt2}{2}$ and $1995^\frac{2-\sqrt2}{2}.$ Multiplying these gives $1995^2$
$1995^2\pmod{1000}\equiv 995^2\pmod{1000}\equiv (-5)^2\pmod{1000}\equiv 25\pmod{1000}$ , so our answer is $\boxed{025}$

Answer:  025
Problem: Find the last three digits of the product of the positive roots of $\sqrt{1995}x^{\log_{1995}x}=x^2$

Solution: Let $y=\log_{1995}x$ . Rewriting the equation in terms of $y$ , we have \[\sqrt{1995}\left(1995^y\right)^y=1995^{2y}\] \[1995^{y^2+\frac{1}{2}}=1995^{2y}\] \[y^2+\frac{1}{2}=2y\] \[2y^2-4y+1=0\] \[y=\frac{4\pm\sqrt{16-\left(4\right)\left(2\right)\left(1\right)}}{4}=\frac{4\pm\sqrt{8}}{4}=\frac{2\pm\sqrt{8}}{2}={1\pm\sqrt{2}}\] Thus, the product of the positive roots is $\left(1995^{\frac{2+\sqrt{8}}{2}}\right)\left(1995^{\frac{2-\sqrt{8}}{2}}\right)=1995^2=\left(2000-5\right)^2$ , so the last three digits are $\boxed{025}$

Answer:  025
Problem: Starting at $(0,0),$ an object moves in the coordinate plane via a sequence of steps, each of length one.  Each step is left, right, up, or down, all four equally likely.  Let $p$ be the probability that the object reaches $(2,2)$ in six or fewer steps.  Given that $p$ can be written in the form $m/n,$ where $m$ and $n$ are relatively prime positive integers, find $m+n.$

Solution: It takes an even number of steps for the object to reach $(2,2)$ , so the number of steps the object may have taken is either $4$ or $6$
If the object took $4$ steps, then it must have gone two steps and two steps , in some permutation. There are $\frac{4!}{2!2!} = 6$ ways for these four steps of occuring, and the probability is $\frac{6}{4^{4}}$
If the object took $6$ steps, then it must have gone two steps and two steps , and an additional pair of moves that would cancel out, either N/S or W/E . The sequences N,N,N,E,E,S can be permuted in $\frac{6!}{3!2!1!} = 60$ ways. However, if the first four steps of the sequence are N,N,E,E in some permutation, it would have already reached the point $(2,2)$ in four moves. There are $\frac{4!}{2!2!}$ ways to order those four steps and $2!$ ways to determine the order of the remaining two steps, for a total of $12$ sequences that we have to exclude. This gives $60-12=48$ sequences of steps. There are the same number of sequences for the steps N,N,E,E,E,W , so the probability here is $\frac{2 \times 48}{4^6}$
The total probability is $\frac{6}{4^4} + \frac{96}{4^6} = \frac{3}{64}$ , and $m+n= \boxed{067}$

Answer:  067
Problem: Starting at $(0,0),$ an object moves in the coordinate plane via a sequence of steps, each of length one.  Each step is left, right, up, or down, all four equally likely.  Let $p$ be the probability that the object reaches $(2,2)$ in six or fewer steps.  Given that $p$ can be written in the form $m/n,$ where $m$ and $n$ are relatively prime positive integers, find $m+n.$

Solution: Let's let the object wander for 6 steps so we get a constant denominator of $4^{6}$
In the first case, we count how many ways the object can end at (2,2), at the end of 6 steps. We will also count it even if we go to (2,2), and go back to (2,2). So, there are 2 different paths for the object to end at (2,2):
1.To go a permutation of R,R,R,U,U,L or
2.To go a permutation of R,R,U,U,U,D.
There are 60 ways to permute for each case, giving a total of 120 ways for the object to succeed and end at (2,2). In these 120 ways the object could reach (2,2) first and then come back to (2,2). This will be a factor in our second case.
In the second case, the object can get to (2,2) first in 4 moves, then move away from (2,2) with the remaing 2 moves. So, there are 6 ways to get to (2,2) in 4 moves, then there are 16 ways the object can "move around", but 4 of the ways will return the object back to (2,2). Those 4 ways were already counted in the first case, so we should only count 12 of the 16 ways to prevent over-counting. Thus, there are $12*6 =$ 72 ways in the second case.
So, in all, there are 120+72 ways for the object to achieve it's goal of moving to (2,2). Put that over our denominator, we get $\frac{192}{4^{6}} = \frac{3}{4^{3}} = \frac{3}{64}$ , in which adding the numerator and denominator get us an answer of $\boxed{067}$

Answer:  067
Problem: Circles of radius $3$ and $6$ are externally tangent to each other and are internally tangent to a circle of radius $9$ . The circle of radius $9$ has a chord that is a common external tangent of the other two circles. Find the square of the length of this chord.

Solution: We label the points as following: the centers of the circles of radii $3,6,9$ are $O_3,O_6,O_9$ respectively, and the endpoints of the chord are $P,Q$ . Let $A_3,A_6,A_9$ be the feet of the perpendiculars from $O_3,O_6,O_9$ to $\overline{PQ}$ (so $A_3,A_6$ are the points of tangency ). Then we note that $\overline{O_3A_3} \parallel \overline{O_6A_6} \parallel \overline{O_9A_9}$ , and $O_6O_9 : O_9O_3 = 3:6 = 1:2$ . Thus, $O_9A_9 = \frac{2 \cdot O_6A_6 + 1 \cdot O_3A_3}{3} = 5$ (consider similar triangles). Applying the Pythagorean Theorem to $\triangle O_9A_9P$ , we find that \[PQ^2 = 4(A_9P)^2 = 4[(O_9P)^2-(O_9A_9)^2] = 4[9^2-5^2] = \boxed{224}\]

Answer:  224
Problem: For certain real values of $a, b, c,$ and $d_{},$ the equation $x^4+ax^3+bx^2+cx+d=0$ has four non-real roots.  The product of two of these roots is $13+i$ and the sum of the other two roots is $3+4i,$ where $i=\sqrt{-1}.$ Find $b.$

Solution: Since the coefficients of the polynomial are real, it follows that the non-real roots must come in complex conjugate pairs. Let the first two roots be $m,n$ . Since $m+n$ is not real, $m,n$ are not conjugates, so the other pair of roots must be the conjugates of $m,n$ . Let $m'$ be the conjugate of $m$ , and $n'$ be the conjugate of $n$ . Then, \[m\cdot n = 13 + i,m' + n' = 3 + 4i\Longrightarrow m'\cdot n' = 13 - i,m + n = 3 - 4i.\] By Vieta's formulas , we have that $b = mm' + nn' + mn' + nm' + mn + m'n' = (m + n)(m' + n') + mn + m'n' = \boxed{051}$

Answer:  051
Problem: For certain real values of $a, b, c,$ and $d_{},$ the equation $x^4+ax^3+bx^2+cx+d=0$ has four non-real roots.  The product of two of these roots is $13+i$ and the sum of the other two roots is $3+4i,$ where $i=\sqrt{-1}.$ Find $b.$

Solution: Let's assume that the 2 roots multiplied together are p+qi, and r+si, and the two roots added together are the conjugates of the previous roots. Using Vieta, we get \[b = (p+qi)(r+si) + (p+qi)(r-si) + (p-qi)(r+si) + (p-qi)(r-si) + (p+qi)(p-qi) + (r+si)(r-si) =\]
\[(p+qi+p-qi)(r+si+r-si) + (p+qi)(p-qi) + (r+si)(r-si) =\]
\[(2p)(2r) + p^2 + q^2 + r^2 + s^2 = 4pr + p^2 + q^2 + r^2 + s^2 = (p+r)^2 + 2pr + q^2 + s^2\]
We are now stuck. We can't simplify further. But, we look back to the problem and see that the two roots that are multiplied together give a product of $13+i$ , and the two roots that are added give $3+4i$ . This gets three equations necessary for solving the problem. \[p+r = 3\] \[pr-qs = 13\] \[-q-s = 4\] So, alright. Let's use the first equation to get that $(p+r)^2 = 9$ , and substitute that in.  Now, the equation becomes:
\[b = 9 + 2pr + q^2 + s^2\]
We wish that we can turn the 2pr into 2qs. Fortunately, we can do that. By using the second equation, we can manipulate it to be $pr = 13+qs$ , and substitute that in.
\[b = 9 + 2(13+qs) + q^2 + s^2 = 9 + 26 + 2qs + q^2 + s^2 = 35 + (q+s)^2\]
We can square both sides of the third equation, and get $(q+s)^2 = 16$ We substitute that in and we get
\[b = 35+16 = \boxed{051}\]

Answer:  051
Problem: Let $n=2^{31}3^{19}.$ How many positive integer divisors of $n^2$ are less than $n_{}$ but do not divide $n_{}$

Solution: We know that $n^2 = 2^{62}3^{38}$ must have $(62+1)\times (38+1)$ factors by its prime factorization . If we group all of these factors (excluding $n$ ) into pairs that multiply to $n^2$ , then one factor per pair is less than $n$ , and so there are $\frac{63\times 39-1}{2} = 1228$ factors of $n^2$ that are less than $n$ . There are $32\times20-1 = 639$ factors of $n$ , which clearly are less than $n$ , but are still factors of $n$ . Therefore, using complementary counting, there are $1228-639=\boxed{589}$ factors of $n^2$ that do not divide $n$

Answer:  589
Problem: Let $n=2^{31}3^{19}.$ How many positive integer divisors of $n^2$ are less than $n_{}$ but do not divide $n_{}$

Solution: Let $n=p_1^{k_1}p_2^{k_2}$ for some prime $p_1,p_2$ . Then $n^2$ has $\frac{(2k_1+1)(2k_2+1)-1}{2}$ factors less than $n$
This simplifies to $\frac{4k_1k_2+2k_1+2k_2}{2}=2k_1k_2+k_1+k_2$
The number of factors of $n$ less than $n$ is equal to $(k_1+1)(k_2+1)-1=k_1k_2+k_1+k_2$
Thus, our general formula for $n=p_1^{k_1}p_2^{k_2}$ is
Number of factors that satisfy the above $=(2k_1k_2+k_1+k_2)-(k_1k_2+k_1+k_2)=k_1k_2$
Incorporating this into our problem gives $19\times31=\boxed{589}$

Answer:  589
Problem: Let $n=2^{31}3^{19}.$ How many positive integer divisors of $n^2$ are less than $n_{}$ but do not divide $n_{}$

Solution: Consider divisors of $n^2: a,b$ such that $ab=n^2$ .
WLOG, let $b\ge{a}$ and $b=\frac{n}{a}$
Then, it is easy to see that $a$ will always be less than $b$ as we go down the divisor list of $n^2$ until we hit $n$
Therefore, the median divisor of $n^2$ is $n$
Then, there are $(63)(39)=2457$ divisors of $n^2$ . Exactly $\frac{2457-1}{2}=1228$ of these divisors are $<n$
There are $(32)(20)-1=639$ divisors of $n$ that are $<n$
Therefore, the answer is $1228-639=\boxed{589}$

Answer:  589
Problem: Given that $(1+\sin t)(1+\cos t)=5/4$ and
where $k, m,$ and $n_{}$ are positive integers with $m_{}$ and $n_{}$ relatively prime , find $k+m+n.$

Solution: From the givens, $2\sin t \cos t + 2 \sin t + 2 \cos t = \frac{1}{2}$ , and adding $\sin^2 t + \cos^2t = 1$ to both sides gives $(\sin t + \cos t)^2 + 2(\sin t + \cos t) = \frac{3}{2}$ .  Completing the square on the left in the variable $(\sin t + \cos t)$ gives $\sin t + \cos t = -1 \pm \sqrt{\frac{5}{2}}$ .  Since $|\sin t + \cos t| \leq \sqrt 2 < 1 + \sqrt{\frac{5}{2}}$ , we have $\sin t + \cos t = \sqrt{\frac{5}{2}} - 1$ .  Subtracting twice this from our original equation gives $(\sin t - 1)(\cos t - 1) = \sin t \cos t - \sin t - \cos t + 1 = \frac{13}{4} - \sqrt{10}$ , so the answer is $13 + 4 + 10 = \boxed{027}$

Answer:  027
Problem: Given that $(1+\sin t)(1+\cos t)=5/4$ and
where $k, m,$ and $n_{}$ are positive integers with $m_{}$ and $n_{}$ relatively prime , find $k+m+n.$

Solution: Let $(1 - \sin t)(1 - \cos t) = x$ . Multiplying $x$ with the given equation, $\frac{5x}{4} = (1 - \sin^2 t)(1 - \cos^2 t) = \sin^2 t \cos ^2 t$ , and $\frac{\sqrt{5x}}{2} = \sin t \cos t$ . Simplifying and rearranging the given equation, $\sin t + \cos t = \frac{5}{4} - (\sin^2 t + \cos^2 t) - \sin t \cos t = \frac{1}{4} - \frac{\sqrt{5x}}{2}$ . Notice that $(1 + \sin t)(1 + \cos t) - 2(\sin t + \cos t) = x$ , and substituting, $x = \frac{5}{4} - 2( \frac{1}{4} - \frac{\sqrt{5x}}{2}) = \frac{3}{4} + \sqrt{5x}$ . Rearranging and squaring, $5x = x^2 - \frac{3}{2} x + \frac{9}{16}$ , so $x^2 - \frac{13}{2} x + \frac{9}{16} = 0$ , and $x = \frac{13}{4} \pm \sqrt{10}$ , but clearly, $0 \leq x < 4$ . Therefore, $x = \frac{13}{4} - \sqrt{10}$ , and the answer is $13 + 4 + 10 = \boxed{027}$

Answer:  027
Problem: Given that $(1+\sin t)(1+\cos t)=5/4$ and
where $k, m,$ and $n_{}$ are positive integers with $m_{}$ and $n_{}$ relatively prime , find $k+m+n.$

Solution: We want $1+\sin t \cos t-\sin t-\cos t$ . However, note that we only need to find $\sin t+\cos t$
Let $y = \sin t+\cos t \rightarrow y^2 = \sin^2 t + \cos^2 t + 2\sin t \cos t = 1 + 2\sin t \cos t$
From this we have $\sin t \cos t = \frac{y^2-1}{2}$ and $\sin t + \cos t = y$
Substituting, we have $2y^2+4y-3=0 \rightarrow y = \frac {-2 \pm \sqrt{10}}{2}$
$\frac{5}{4} - 2(\frac{-2+\sqrt{10}}{2}) = \frac{13}{4}-\sqrt{10} \rightarrow 13+10+4=\boxed{027}$

Answer:  027
Problem: For how many ordered pairs of positive integers $(x,y),$ with $y<x\le 100,$ are both $\frac xy$ and $\frac{x+1}{y+1}$ integers?

Solution: Since $y|x$ $y+1|x+1$ , then $\text{gcd}\,(y,x)=y$ (the bars indicate divisibility ) and $\text{gcd}\,(y+1,x+1)=y+1$ . By the Euclidean algorithm , these can be rewritten respectively as $\text{gcd}\,(y,x-y)=y$ and $\text{gcd}\, (y+1,x-y)=y+1$ , which implies that both $y,y+1 | x-y$ . Also, as $\text{gcd}\,(y,y+1) = 1$ , it follows that $y(y+1)|x-y$
Thus, for a given value of $y$ , we need the number of multiples of $y(y+1)$ from $0$ to $100-y$ (as $x \le 100$ ). It follows that there are $\left\lfloor\frac{100-y}{y(y+1)} \right\rfloor$ satisfactory positive integers for all integers $y \le 100$ . The answer is
\[\sum_{y=1}^{99} \left\lfloor\frac{100-y}{y(y+1)} \right\rfloor = 49 + 16 + 8 + 4 + 3 + 2 + 1 + 1 + 1 = \boxed{085}.\]

Answer:  085
Problem: For how many ordered pairs of positive integers $(x,y),$ with $y<x\le 100,$ are both $\frac xy$ and $\frac{x+1}{y+1}$ integers?

Solution: We know that $x \equiv 0 \mod y$ and $x+1 \equiv 0 \mod y+1$
Write $x$ as $ky$ for some integer $k$ . Then, $ky+1 \equiv 0\mod y+1$ . We can add $k$ to each side in order to factor out a $y+1$ . So, $ky+k+1 \equiv k \mod y+1$ or $k(y+1)+1 \equiv k \mod y+1$ . We know that $k(y+1) \equiv 0 \mod y+1$ . We finally achieve the congruence $1-k \equiv 0 \mod y+1$
We can now write $k$ as $(y+1)a+1$ . Plugging this back in, if we have a value for $y$ , then $x = ky = ((y+1)a+1)y = y(y+1)a+y$ . We only have to check values of $y$ when $y(y+1)<100$ . This yields the equations $x = 2a+1, 6a+2, 12a+3, 20a+4, 30a+5, 42a+6, 56a+7, 72a+8, 90a+9$
Finding all possible values of $a$ such that $y<x<100$ , we get $49 + 16 + 8 + 4 + 3 + 2 + 1 + 1 + 1 = \boxed{085}.$

Answer:  085
Problem: For how many ordered pairs of positive integers $(x,y),$ with $y<x\le 100,$ are both $\frac xy$ and $\frac{x+1}{y+1}$ integers?

Solution: We use casework:
For $y=1$ , we have $3,5,\cdots ,99$ , or $49$ cases.
For $y=2$ , we have $8,14,\cdots ,98$ , or $16$ cases.
For $y=3$ , we have $15,27,\cdots ,99$ , or $8$ cases.
For $y=4$ , we have $24,44\cdots ,84$ , or $4$ cases.
For $y=5$ , we have $35,65,95$ , or $3$ cases.
For $y=6$ , we have $48,90$ , or $2$ cases.
For $y=7$ , we have $63$ , or $1$ case.
For $y=8$ , we have $80$ , or $1$ case.
For $y=9$ , we have $99$ , or $1$ case.
Adding, we get our final result of $\boxed{085}.$

Answer:  085
Problem: Triangle $ABC$ is isosceles , with $AB=AC$ and altitude $AM=11.$ Suppose that there is a point $D$ on $\overline{AM}$ with $AD=10$ and $\angle BDC=3\angle BAC.$ Then the perimeter of $\triangle ABC$ may be written in the form $a+\sqrt{b},$ where $a$ and $b$ are integers.  Find $a+b.$
[asy] import graph; size(5cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-1.55,xmax=7.95,ymin=-4.41,ymax=5.3;  draw((1,3)--(0,0)); draw((0,0)--(2,0)); draw((2,0)--(1,3)); draw((1,3)--(1,0)); draw((1,0.7)--(0,0)); draw((1,0.7)--(2,0)); label("$11$",(1,1.63),W);  dot((1,3),ds); label("$A$",(1,3),N); dot((0,0),ds); label("$B$",(0,0),SW); dot((2,0),ds); label("$C$",(2,0),SE); dot((1,0),ds); label("$M$",(1,0),S); dot((1,0.7),ds); label("$D$",(1,0.7),NE);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);[/asy]

Solution: Let $x=\angle CAM$ , so $3x=\angle CDM$ . Then, $\frac{\tan 3x}{\tan x}=\frac{CM/1}{CM/11}=11$ . Expanding $\tan 3x$ using the angle sum identity gives \[\tan 3x=\tan(2x+x)=\frac{3\tan x-\tan^3x}{1-3\tan^2x}.\] Thus, $\frac{3-\tan^2x}{1-3\tan^2x}=11$ . Solving, we get $\tan x= \frac 12$ . Hence, $CM=\frac{11}2$ and $AC= \frac{11\sqrt{5}}2$ by the Pythagorean Theorem . The total perimeter is $2(AC + CM) = \sqrt{605}+11$ . The answer is thus $a+b=\boxed{616}$

Answer:  616
Problem: Triangle $ABC$ is isosceles , with $AB=AC$ and altitude $AM=11.$ Suppose that there is a point $D$ on $\overline{AM}$ with $AD=10$ and $\angle BDC=3\angle BAC.$ Then the perimeter of $\triangle ABC$ may be written in the form $a+\sqrt{b},$ where $a$ and $b$ are integers.  Find $a+b.$
[asy] import graph; size(5cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-1.55,xmax=7.95,ymin=-4.41,ymax=5.3;  draw((1,3)--(0,0)); draw((0,0)--(2,0)); draw((2,0)--(1,3)); draw((1,3)--(1,0)); draw((1,0.7)--(0,0)); draw((1,0.7)--(2,0)); label("$11$",(1,1.63),W);  dot((1,3),ds); label("$A$",(1,3),N); dot((0,0),ds); label("$B$",(0,0),SW); dot((2,0),ds); label("$C$",(2,0),SE); dot((1,0),ds); label("$M$",(1,0),S); dot((1,0.7),ds); label("$D$",(1,0.7),NE);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);[/asy]

Solution: In a similar fashion, we encode the angles as complex numbers, so if $BM=x$ , then $\angle BAD=\text{Arg}(11+xi)$ and $\angle BDM=\text{Arg}(1+xi)$ . So we need only find $x$ such that $\text{Arg}((11+xi)^3)=\text{Arg}(1331-33x^2+(363x-x^3)i)=\text{Arg}(1+xi)$ . This will happen when $\frac{363x-x^3}{1331-33x^2}=x$ ,  which simplifies to $121x-4x^3=0$ . Therefore, $x=\frac{11}{2}$ . By the Pythagorean Theorem, $AB=\frac{11\sqrt{5}}{2}$ , so the perimeter is $11+11\sqrt{5}=11+\sqrt{605}$ , giving us our answer, $\boxed{616}$

Answer:  616
Problem: Triangle $ABC$ is isosceles , with $AB=AC$ and altitude $AM=11.$ Suppose that there is a point $D$ on $\overline{AM}$ with $AD=10$ and $\angle BDC=3\angle BAC.$ Then the perimeter of $\triangle ABC$ may be written in the form $a+\sqrt{b},$ where $a$ and $b$ are integers.  Find $a+b.$
[asy] import graph; size(5cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-1.55,xmax=7.95,ymin=-4.41,ymax=5.3;  draw((1,3)--(0,0)); draw((0,0)--(2,0)); draw((2,0)--(1,3)); draw((1,3)--(1,0)); draw((1,0.7)--(0,0)); draw((1,0.7)--(2,0)); label("$11$",(1,1.63),W);  dot((1,3),ds); label("$A$",(1,3),N); dot((0,0),ds); label("$B$",(0,0),SW); dot((2,0),ds); label("$C$",(2,0),SE); dot((1,0),ds); label("$M$",(1,0),S); dot((1,0.7),ds); label("$D$",(1,0.7),NE);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);[/asy]

Solution: Let $\angle BAD=\alpha$ , so $\angle BDM=3\alpha$ $\angle BDA=180-3\alpha$ , and thus $\angle ABD=2\alpha.$ We can then draw the angle bisector of $\angle ABD$ , and let it intersect $\overline{AM}$ at $E.$ Since $\angle BAE=\angle ABE$ $AE=BE.$ Let $AE=x$ . Then we see by the Pythagorean Theorem, $BM=\sqrt{BE^2-ME^2}=\sqrt{x^2-(11-x)^2}=\sqrt{22x-121}$ $BD=\sqrt{BM^2+1}=\sqrt{22x-120}$ $BA=\sqrt{BM^2+121}=\sqrt{22x}$ , and $DE=10-x.$ By the angle bisector theorem, $BA/BD=EA/ED.$ Substituting in what we know for the lengths of those segments, we see that \[\frac{\sqrt{22x}}{\sqrt{22x-120}}=\frac{x}{10-x}.\] multiplying by both denominators and squaring both sides yields \[22x(10-x)^2=x^2(22x-120)\] which simplifies to $x=\frac{55}{8}.$ Substituting this in for x in the equations for $BA$ and $BM$ yields $BA=\frac{\sqrt{605}}{2}$ and $BM=\frac{11}{2}.$ Thus the perimeter is $11+\sqrt{605}$ , and the answer is $\boxed{616}$

Answer:  616
Problem: Triangle $ABC$ is isosceles , with $AB=AC$ and altitude $AM=11.$ Suppose that there is a point $D$ on $\overline{AM}$ with $AD=10$ and $\angle BDC=3\angle BAC.$ Then the perimeter of $\triangle ABC$ may be written in the form $a+\sqrt{b},$ where $a$ and $b$ are integers.  Find $a+b.$
[asy] import graph; size(5cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-1.55,xmax=7.95,ymin=-4.41,ymax=5.3;  draw((1,3)--(0,0)); draw((0,0)--(2,0)); draw((2,0)--(1,3)); draw((1,3)--(1,0)); draw((1,0.7)--(0,0)); draw((1,0.7)--(2,0)); label("$11$",(1,1.63),W);  dot((1,3),ds); label("$A$",(1,3),N); dot((0,0),ds); label("$B$",(0,0),SW); dot((2,0),ds); label("$C$",(2,0),SE); dot((1,0),ds); label("$M$",(1,0),S); dot((1,0.7),ds); label("$D$",(1,0.7),NE);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);[/asy]

Solution: The triangle is symmetrical so we can split it in half ( $\triangle ABM$ and $\triangle ACM$ ).
Let $\angle BAM = y$ and $\angle BDM = 3y$ . By the Law of Sines on triangle $BAD$ $\frac{10}{\sin 2y} = \frac{BD}{\sin y}$ . Using $\sin 2y = 2\sin y\cos y$ we can get $BD = \frac{5}{\cos y}$ . We can use this information to relate $BD$ to $DM$ by using the Law of Sines on triangle $BMD$
\[\frac{\frac{5}{\cos y}}{\sin BMD} = \frac{1}{\sin 90^\circ - 3y}\]
$\sin BMD = 1$ (as $\angle BMD$ is a right angle), so $\frac{1}{\sin 90^\circ - 3y} = \frac{5}{\cos y}$ . Using the identity $\sin 90^\circ - x = \cos x$ , we can turn the equation into::
\[\frac{1}{\cos 3y} = \frac{5}{\cos y}\]
\[5\cos 3y = \cos y\]
\[5(4\cos ^3 y - 3\cos y) = \cos y\]
\[20\cos ^3 y = 16 \cos y\]
\[5\cos ^3 y = 4\cos y\]
\[5\cos ^2 y = 4\]
\[\cos ^2 y = \frac{4}{5}\]
Now that we've found $\cos y$ , we can look at the side lengths of $BM$ and $AB$ (since they are symmetrical, the perimeter of $\triangle ABC$ is $2(BM + AB)$
We note that $BM = 11\tan y$ and $AB = 11\sec y$
\[\sin ^2 y = 1 - \cos ^2 y\]
\[\sin ^2 y = \frac{1}{5}\]
\[\tan ^2 y = \frac{1}{4}\]
\[\tan y = \frac{1}{2}\]
(Note it is positive since $BM > 0$ ).
\[\sec ^2 y = \frac{5}{4}\]
\[\sec y = \frac{\sqrt{5}}{2}\]
\[BM + AB = 11\frac{\sqrt{5}+1}{2}\]
\[2(BM + AB) = 11(\sqrt{5} + 1)\]
\[2(BM + AB) = 11\sqrt{5} + 11\]
\[2(BM + AB) = \sqrt{605} + 11\]
The answer is $\boxed{616}$

Answer:  616