Problem: In $\triangle ABC$ , the sides have integer lengths and $AB=AC$ . Circle $\omega$ has its center at the incenter of $\triangle ABC$ . An excircle of $\triangle ABC$ is a circle in the exterior of $\triangle ABC$ that is tangent to one side of the triangle and tangent to the extensions of the other two sides. Suppose that the excircle tangent to $\overline{BC}$ is internally tangent to $\omega$ , and the other two excircles are both externally tangent to $\omega$ . Find the minimum possible value of the perimeter of $\triangle ABC$

Solution: [asy]  unitsize(1cm);   var x = 9;  pair A = (0,sqrt(x^2-1)); pair B = (-1,0); pair C = (1,0);  dot(Label("$A$",A,NE),A); dot(Label("$B$",B,SW),B); dot(Label("$C$",C,SE),C);  draw(A--B--C--cycle);   var r = sqrt((x-1)/(x+1));  pair I = (0,r); dot(Label("$I$",I,SE),I); draw(circle(I,r)); draw(Label("$r$"),I--I+r*SSW,dashed);   pair M = intersectionpoint(A--B,circle(I,r)); pair N = (0,0); pair O = intersectionpoint(A--C,circle(I,r));  dot(Label("$M$",M,W),M); dot(Label("$N$",N,S),N); dot(Label("$O$",O,E),O);  var rN = sqrt((x+1)/(x-1));  pair EN = (0,-rN); dot(Label("$E_N$",EN,SE),EN); draw(circle(EN,rN)); draw(Label("$r_N$"),EN--EN+rN*SSW,dashed);   pair AB = (-1-2/(x-1),-2rN); pair AC = (1+2/(x-1),-2rN);  draw(B--AB,EndArrow); draw(C--AC,EndArrow);  pair H = intersectionpoint(B--AB,circle(EN,rN)); dot(Label("$H$",H,W),H);   var rM = sqrt(x^2-1);  pair EM = (-x,rM); dot(Label("$E_M$",EM,SW),EM); draw(Label("$r_M$"),EM--EM+rM*SSE,dashed);   pair CB = (-x-1,0); pair CA = (-2/x,sqrt(x^2-1)+2(sqrt(x^2-1)/x));  draw(B--CB,EndArrow); draw(A--CA,EndArrow);   pair J = intersectionpoint(A--B,circle(EM,rM)); pair K = intersectionpoint(B--CB,circle(EM,rM));  dot(Label("$J$",J,W),J); dot(Label("$K$",K,S),K);   draw(arc(EM,rM,-100,15),Arrows);  [/asy]
First, assume $BC=2$ and $AB=AC=x$ . The triangle can be scaled later if necessary. Let $I$ be the incenter and let $r$ be the inradius. Let the points at which the incircle intersects $AB$ $BC$ , and $CA$ be denoted $M$ $N$ , and $O$ , respectively.
Next, we calculate $r$ in terms of $x$ . Note the right triangle formed by $A$ $I$ , and $M$ . The length $IM$ is equal to $r$ . Using the Pythagorean Theorem, the length $AN$ is $\sqrt{x^2-1}$ , so the length $AI$ is $\sqrt{x^2-1}-r$ . Note that $BN$ is half of $BC=2$ , and by symmetry caused by the incircle, $BN=BM$ and $BM=1$ , so $MA=x-1$ . Applying the Pythagorean Theorem to $AIM$ , we get \[r^2+(x-1)^2=\left(\sqrt{x^2-1}-r\right)^2.\] Expanding yields \[r^2+x^2-2x+1=x^2-1-2r\sqrt{x^2-1}+r^2,\] which can be simplified to \[2r\sqrt{x^2-1}=2x-2.\] Dividing by $2$ and then squaring results in \[r^2(x^2-1)=(x-1)^2,\] and isolating $r^2$ gets us \[r^2=\frac{(x-1)^2}{x^2-1}=\frac{(x-1)^2}{(x+1)(x-1)}=\frac{x-1}{x+1},\] so $r=\sqrt{\frac{x-1}{x+1}}$
We then calculate the radius of the excircle tangent to $BC$ . We denote the center of the excircle $E_N$ and the radius $r_N$
Consider the quadrilateral formed by $M$ $I$ $E_N$ , and the point at which the excircle intersects the extension of $AB$ , which we denote $H$ . By symmetry caused by the excircle, $BN=BH$ , so $BH=1$
Note that triangles $MBI$ and $NBI$ are congruent, and $HBE$ and $NBE$ are also congruent. Denoting the measure of angles $MBI$ and $NBI$ measure $\alpha$ and the measure of angles $HBE$ and $NBE$ measure $\beta$ , straight angle $MBH=2\alpha+2\beta$ , so $\alpha + \beta=90^\circ$ . This means that angle $IBE$ is a right angle, so it forms a right triangle.
Setting the base of the right triangle to $IE$ , the height is $BN=1$ and the base consists of $IN=r$ and $EN=r_N$ . Triangles $INB$ and $BNE$ are similar to $IBE$ , so $\frac{IN}{BN}=\frac{BN}{EN}$ , or $\frac{r}{1}=\frac{1}{r_N}$ . This makes $r_N$ the reciprocal of $r$ , so $r_N=\sqrt{\frac{x+1}{x-1}}$
Circle $\omega$ 's radius can be expressed by the distance from the incenter $I$ to the bottom of the excircle with center $E_N$ . This length is equal to $r+2r_N$ , or $\sqrt{\frac{x-1}{x+1}}+2\sqrt{\frac{x+1}{x-1}}$ . Denote this value $r_\omega$
Finally, we calculate the distance from the incenter $I$ to the closest point on the excircle tangent to $AB$ , which forms another radius of circle $\omega$ and is equal to $r_\omega$ . We denote the center of the excircle $E_M$ and the radius $r_M$ . We also denote the points where the excircle intersects $AB$ and the extension of $BC$ using $J$ and $K$ , respectively. In order to calculate the distance, we must find the distance between $I$ and $E_M$ and subtract off the radius $r_M$
We first must calculate the radius of the excircle. Because the excircle is tangent to both $AB$ and the extension of $AC$ , its center must lie on the angle bisector formed by the two lines, which is parallel to $BC$ . This means that the distance from $E_M$ to $K$ is equal to the length of $AN$ , so the radius is also $\sqrt{x^2-1}$
Next, we find the length of $IE_M$ . We can do this by forming the right triangle $IAE_M$ . The length of leg $AI$ is equal to $AN$ minus $r$ , or $\sqrt{x^2-1}-\sqrt{\frac{x-1}{x+1}}$ . In order to calculate the length of leg $AE_M$ , note that right triangles $AJE_M$ and $BNA$ are congruent, as $JE_M$ and $NA$ share a length of $\sqrt{x^2-1}$ , and angles $E_MAJ$ and $NAB$ add up to the right angle $NAE_M$ . This means that $AE_M=BA=x$
Using Pythagorean Theorem, we get \[IE_M=\sqrt{\left(\sqrt{x^2-1}-\sqrt{\frac{x-1}{x+1}}\right)^2+x^2}.\] Bringing back \[r_\omega=IE_M-r_M\] and substituting in some values, the equation becomes \[r_\omega=\sqrt{\left(\sqrt{x^2-1}-\sqrt{\frac{x-1}{x+1}}\right)^2+x^2}-\sqrt{x^2-1}.\] Rearranging and squaring both sides gets \[\left(r_\omega+\sqrt{x^2-1}\right)^2=\left(\sqrt{x^2-1}-\sqrt{\frac{x-1}{x+1}}\right)^2+x^2.\] Distributing both sides yields \[r_\omega^2+2r_\omega\sqrt{x^2-1}+x^2-1=x^2-1-2\sqrt{x^2-1}\sqrt{\frac{x-1}{x+1}}+\frac{x-1}{x+1}+x^2.\] Canceling terms results in \[r_\omega^2+2r_\omega\sqrt{x^2-1}=-2\sqrt{x^2-1}\sqrt{\frac{x-1}{x+1}}+\frac{x-1}{x+1}+x^2.\] Since \[-2\sqrt{x^2-1}\sqrt{\frac{x-1}{x+1}}=-2\sqrt{(x+1)(x-1)\frac{x-1}{x+1}}=-2(x-1),\] We can further simplify to \[r_\omega^2+2r_\omega\sqrt{x^2-1}=-2(x-1)+\frac{x-1}{x+1}+x^2.\] Substituting out $r_\omega$ gets \[\left(\sqrt{\frac{x-1}{x+1}}+2\sqrt{\frac{x+1}{x-1}}\right)^2+2\left(\sqrt{\frac{x-1}{x+1}}+2\sqrt{\frac{x+1}{x-1}}\right)\sqrt{x^2-1}=-2(x-1)+\frac{x-1}{x+1}+x^2\] which when distributed yields \[\frac{x-1}{x+1}+4+4\left(\frac{x+1}{x-1}\right)+2(x-1+2(x+1))=-2(x-1)+\frac{x-1}{x+1}+x^2.\] After some canceling, distributing, and rearranging, we obtain \[4\left(\frac{x+1}{x-1}\right)=x^2-8x-4.\] Multiplying both sides by $x-1$ results in \[4x+4=x^3-x^2-8x^2+8x-4x+4,\] which can be rearranged into \[x^3-9x^2=0\] and factored into \[x^2(x-9)=0.\] This means that $x$ equals $0$ or $9$ , and since a side length of $0$ cannot exist, $x=9$
As a result, the triangle must have sides in the ratio of $9:2:9$ . Since the triangle must have integer side lengths, and these values share no common factors greater than $1$ , the triangle with the smallest possible perimeter under these restrictions has a perimeter of $9+2+9=\boxed{020}$ . ~ emerald_block

Answer:  020