Navvye/Olympiad-Problems-CSV huggingface dataset:
Problem: Abe can paint the room in 15 hours, Bea can paint 50 percent faster than Abe, and Coe can paint twice as fast as Abe. Abe begins to paint the room and works alone for the first hour and a half. Then Bea joins Abe, and they work together until half the room is painted. Then Coe joins Abe and Bea, and they work together until the entire room is painted. Find the number of minutes after Abe begins for the three of them to finish painting the room.

Solution: From the given information, we can see that Abe can paint $\frac{1}{15}$ of the room in an hour, Bea can paint $\frac{1}{15}\times\frac{3}{2} = \frac{1}{10}$ of the room in an hour, and Coe can paint the room in $\frac{1}{15}\times 2 = \frac{2}{15}$ of the room in an hour.  After $90$ minutes, Abe has painted $\frac{1}{15}\times\frac{3}{2}=\frac{1}{10}$ of the room.  Working together, Abe and Bea can paint $\frac{1}{15}+\frac{1}{10}=\frac{1}{6}$ of the room in an hour, so it takes then $\frac{2}{5}\div \frac{1}{6}= \frac{12}{5}$ hours to finish the first half of the room.  All three working together can paint $\frac{1}{6}+\frac{2}{15}=\frac{3}{10}$ of the room in an hour, and it takes them $\frac{1}{2}\div \frac{3}{10}=\frac{5}{3}$ hours to finish the room.  The total amount of time they take is \[90+\frac{12}{5}\times 60+\frac{5}{3}\times 60 = 90+ 144 + 100 = \boxed{334}\]

Answer:  334
Problem: Arnold is studying the prevalence of three health risk factors, denoted by A, B, and C, within a population of men. For each of the three factors, the probability that a randomly selected man in the population has only this risk factor (and none of the others) is 0.1. For any two of the three factors, the probability that a randomly selected man has exactly these two risk factors (but not the third) is 0.14. The probability that a randomly selected man has all three risk factors, given that he has A and B is $\frac{1}{3}$ . The probability that a man has none of the three risk factors given that he does not have risk factor A is $\frac{p}{q}$ , where $p$ and $q$ are relatively prime positive integers. Find $p+q$

Solution: We first assume a population of $100$ to facilitate solving. Then we simply organize the statistics given into a Venn diagram.
[asy]  pair A,B,C,D,E,F,G; A=(0,55); B=(60,55); C=(60,0); D=(0,0); draw(A--B--C--D--A); E=(30,35); F=(20,20); G=(40,20); draw(circle(E,15)); draw(circle(F,15)); draw(circle(G,15));  draw("$A$",(30,52)); draw("$B$",(7,7)); draw("$C$",(53,7));  draw("100",(5,60)); draw("10",(30,40)); draw("10",(15,15)); draw("10",(45,15));  draw("14",(30,16)); draw("14",(38,29)); draw("14",(22,29));  draw("$x$",(30,25)); draw("$y$",(10,45));  [/asy]
Let $x$ be the number of men with all three risk factors.  Since "the probability that a randomly selected man has all three risk factors, given that he has A and B is $\frac{1}{3}$ ," we can tell that $x = \frac{1}{3}(x+14)$ , since there are $x$ people with all three factors and 14 with only A and B.  Thus $x=7$
Let $y$ be the number of men with no risk factors.  It now follows that \[y= 100 - 3 \cdot 10 - 3 \cdot 14 - 7 = 21.\] The number of men with risk factor A is $10+2 \cdot 14+7 = 45$ (10 with only A, 28 with A and one of the others, and 7 with all three).  Thus the number of men without risk factor $A$ is 55, so the desired conditional probability is $21/55$ .  So the answer is $21+55=\boxed{076}$

Answer:  076
Problem: A rectangle has sides of length $a$ and 36. A hinge is installed at each vertex of the rectangle, and at the midpoint of each side of length 36. The sides of length $a$ can be pressed toward each other keeping those two sides parallel so the rectangle becomes a convex hexagon as shown. When the figure is a hexagon with the sides of length $a$ parallel and separated by a distance of 24, the hexagon has the same area as the original rectangle. Find $a^2$
[asy] pair A,B,C,D,E,F,R,S,T,X,Y,Z; dotfactor = 2; unitsize(.1cm); A = (0,0); B = (0,18); C = (0,36); // don't look here D = (12*2.236, 36); E = (12*2.236, 18); F = (12*2.236, 0); draw(A--B--C--D--E--F--cycle); dot(" ",A,NW); dot(" ",B,NW); dot(" ",C,NW); dot(" ",D,NW); dot(" ",E,NW); dot(" ",F,NW); //don't look here R = (12*2.236 +22,0); S = (12*2.236 + 22 - 13.4164,12); T = (12*2.236 + 22,24); X = (12*4.472+ 22,24); Y = (12*4.472+ 22 + 13.4164,12); Z = (12*4.472+ 22,0); draw(R--S--T--X--Y--Z--cycle); dot(" ",R,NW); dot(" ",S,NW); dot(" ",T,NW); dot(" ",X,NW); dot(" ",Y,NW); dot(" ",Z,NW); // sqrt180 = 13.4164 // sqrt5 = 2.236[/asy]

Solution: When we squish the rectangle, the hexagon is composed of a rectangle and two isosceles triangles with side lengths 18, 18, and 24 as shown below.
[asy] pair R,S,T,X,Y,Z; dotfactor = 2; unitsize(.1cm); R = (12*2.236 +22,0); S = (12*2.236 + 22 - 13.4164,12); T = (12*2.236 + 22,24); X = (12*4.472+ 22,24); Y = (12*4.472+ 22 + 13.4164,12); Z = (12*4.472+ 22,0); draw(R--S--T--X--Y--Z--cycle); draw(T--R,red); draw(X--Z,red); dot(" ",R,NW); dot(" ",S,NW); dot(" ",T,NW); dot(" ",X,NW); dot(" ",Y,NW); dot(" ",Z,NW); // sqrt180 = 13.4164 // sqrt5 = 2.236[/asy]
By Heron's Formula, the area of each isosceles triangle is $\sqrt{(30)(12)(12)(6)}=\sqrt{180\times 12^2}=72\sqrt{5}$ . So the area of both is $144\sqrt{5}$ . From the rectangle, our original area is $36a$ . The area of the rectangle in the hexagon is $24a$ . So we have \[24a+144\sqrt{5}=36a\implies 12a=144\sqrt{5}\implies a=12\sqrt{5}\implies a^2=\boxed{720}.\]

Answer:  720
Problem: A rectangle has sides of length $a$ and 36. A hinge is installed at each vertex of the rectangle, and at the midpoint of each side of length 36. The sides of length $a$ can be pressed toward each other keeping those two sides parallel so the rectangle becomes a convex hexagon as shown. When the figure is a hexagon with the sides of length $a$ parallel and separated by a distance of 24, the hexagon has the same area as the original rectangle. Find $a^2$
[asy] pair A,B,C,D,E,F,R,S,T,X,Y,Z; dotfactor = 2; unitsize(.1cm); A = (0,0); B = (0,18); C = (0,36); // don't look here D = (12*2.236, 36); E = (12*2.236, 18); F = (12*2.236, 0); draw(A--B--C--D--E--F--cycle); dot(" ",A,NW); dot(" ",B,NW); dot(" ",C,NW); dot(" ",D,NW); dot(" ",E,NW); dot(" ",F,NW); //don't look here R = (12*2.236 +22,0); S = (12*2.236 + 22 - 13.4164,12); T = (12*2.236 + 22,24); X = (12*4.472+ 22,24); Y = (12*4.472+ 22 + 13.4164,12); Z = (12*4.472+ 22,0); draw(R--S--T--X--Y--Z--cycle); dot(" ",R,NW); dot(" ",S,NW); dot(" ",T,NW); dot(" ",X,NW); dot(" ",Y,NW); dot(" ",Z,NW); // sqrt180 = 13.4164 // sqrt5 = 2.236[/asy]

Solution: Alternatively, use basic geometry. First, scale everything down by dividing everything by 6. Let $a/6=p$ . Then, the dimensions of the central rectangle in the hexagon is p x 4, and the original rectangle is 6 x p. By Pythagorean theorem and splitting the end triangles of the hexagon into two right triangles, the altitude of the end triangles is $\sqrt{3^2-2^2}=\sqrt{5}$ given 2 as the base of the constituent right triangles. The two end triangles form a large rectangle of area $\sqrt{5}$ $4$ . Then, the area of the hexagon is $4p+4\sqrt{5}$ , and the area of the rectangle is $6p$ . Equating them, $p=2\sqrt{5}$ . Multiply by scale factor of 6 and square it to get $36(20)= 720 \implies a^2=\boxed{720}$

Answer:  720
Problem: The repeating decimals $0.abab\overline{ab}$ and $0.abcabc\overline{abc}$ satisfy
\[0.abab\overline{ab}+0.abcabc\overline{abc}=\frac{33}{37},\]
where $a$ $b$ , and $c$ are (not necessarily distinct) digits. Find the three digit number $abc$

Solution: Notice repeating decimals can be written as the following:
$0.\overline{ab}=\frac{10a+b}{99}$
$0.\overline{abc}=\frac{100a+10b+c}{999}$
where a,b,c are the digits. Now we plug this back into the original fraction:
$\frac{10a+b}{99}+\frac{100a+10b+c}{999}=\frac{33}{37}$
Multiply both sides by $999*99.$ This helps simplify the right side as well because $999=111*9=37*3*9$
$9990a+999b+9900a+990b+99c=33/37*37*3*9*99=33*3*9*99$
Dividing both sides by $9$ and simplifying gives:
$2210a+221b+11c=99^2=9801$
At this point, seeing the $221$ factor common to both a and b is crucial to simplify. This is because taking $mod 221$ to both sides results in:
$2210a+221b+11c  \equiv 9801 \mod 221 \iff 11c  \equiv 77 \mod 221$
Notice that we arrived to the result $9801 \equiv 77 \mod 221$ by simply dividing $9801$ by $221$ and seeing $9801=44*221+77.$ Okay, now it's pretty clear to divide both sides by $11$ in the modular equation but we have to worry about $221$ being multiple of $11.$ Well, $220$ is a multiple of $11$ so clearly, $221$ couldn't be. Also, $221=13*17.$ Now finally we simplify and get:
$c \equiv 7 \mod 221$
But we know $c$ is between $0$ and $9$ because it is a digit, so $c$ must be $7.$ Now it is straightforward from here to find $a$ and $b$
$2210a+221b+11(7)=9801 \iff 221(10a+b)=9724 \iff 10a+b=44$
and since a and b are both between $0$ and $9$ , we have $a=b=4$ . Finally we have the $3$ digit integer $\boxed{447}$

Answer:  447
Problem: The repeating decimals $0.abab\overline{ab}$ and $0.abcabc\overline{abc}$ satisfy
\[0.abab\overline{ab}+0.abcabc\overline{abc}=\frac{33}{37},\]
where $a$ $b$ , and $c$ are (not necessarily distinct) digits. Find the three digit number $abc$

Solution: Note that $\frac{33}{37}=\frac{891}{999} = 0.\overline{891}$ .  Also note that the period of $0.abab\overline{ab}+0.abcabc\overline{abc}$ is at most $6$ .  Therefore, we only need to worry about the sum $0.ababab+ 0.abcabc$ .  Adding the two, we get \[\begin{array}{ccccccc}&a&b&a&b&a&b\\ +&a&b&c&a&b&c\\ \hline &8&9&1&8&9&1\end{array}\] From this, we can see that $a=4$ $b=4$ , and $c=7$ , so our desired answer is $\boxed{447}$

Answer:  447
Problem: The repeating decimals $0.abab\overline{ab}$ and $0.abcabc\overline{abc}$ satisfy
\[0.abab\overline{ab}+0.abcabc\overline{abc}=\frac{33}{37},\]
where $a$ $b$ , and $c$ are (not necessarily distinct) digits. Find the three digit number $abc$

Solution: Noting as above that $0.\overline{ab} = \frac{10a + b}{99}$ and $0.\overline{abc} = \frac{100a + 10b + c}{999}$ , let $u = 10a + b$ .
Then \[\frac{u}{99} + \frac{10u + c}{999} = \frac{33}{37}\]
\[\frac{u}{11} + \frac{10u + c}{111} = \frac{9\cdot 33}{37}\]
\[\frac{221u + 11c}{11\cdot 111} = \frac{9\cdot 33}{37}\]
\[221u + 11c = \frac{9\cdot 33\cdot 11\cdot 111}{37}\]
\[221u + 11c = 9\cdot 33^2.\]
Solving for $c$ gives
\[c = 3\cdot 9\cdot 33 - \frac{221u}{11}\]
\[c = 891 - \frac{221u}{11}\]
Because $c$ must be integer, it follows that $u$ must be a multiple of $11$ (because $221$ clearly is not). Inspecting the equation, one finds that only $u = 44$ yields a digit $c, 7$ . Thus $abc = 10u + c = \boxed{447}.$

Answer:  447
Problem: The repeating decimals $0.abab\overline{ab}$ and $0.abcabc\overline{abc}$ satisfy
\[0.abab\overline{ab}+0.abcabc\overline{abc}=\frac{33}{37},\]
where $a$ $b$ , and $c$ are (not necessarily distinct) digits. Find the three digit number $abc$

Solution: We note as above that $0.\overline{ab} = \frac{10a + b}{99}$ and $0.\overline{abc} = \frac{100a + 10b + c}{999},$ so
\[\frac{10a + b}{99} + \frac{100a + 10b + c}{999} = \frac{33}{37} = \frac{891}{999}.\]
As $\frac{10a + b}{99}$ has a factor of $11$ in the denominator while the other two fractions don't, we need that $11$ to cancel, so $11$ divides $10a + b.$ It follows that $a = b,$ so $\frac{10a + b}{99} = \frac{11a}{99} = \frac{111a}{999},$ so
\[\frac{111a}{999} + \frac{110a+c}{999} = \frac{891}{999}.\]
Then $111a + 110a + c = 891,$ or $221a + c = 891.$ Thus $a = b = 4$ and $c = 7,$ so the three-digit integer $abc$ is $\boxed{447}.$

Answer:  447
Problem: Real numbers $r$ and $s$ are roots of $p(x)=x^3+ax+b$ , and $r+4$ and $s-3$ are roots of $q(x)=x^3+ax+b+240$ . Find the sum of all possible values of $|b|$

Solution: Because the coefficient of $x^2$ in both $p(x)$ and $q(x)$ is 0, the remaining root of $p(x)$ is $-(r+s)$ , and the remaining root of $q(x)$ is $-(r+s+1)$ . The coefficients of $x$ in $p(x)$ and $q(x)$ are both equal to $a$ , and equating the two coefficients gives \[rs-(r+s)^2 = (r+4)(s-3)-(r+s+1)^2\] from which $s = \tfrac 12 (5r+13)$ . The product of the roots of $p(x)$ differs from that of $q(x)$ by $240$ , so \[(r+4)\cdot \tfrac 12 (5r+7)\cdot \tfrac 12(7r+15)- r\cdot \tfrac 12 (5r+13)\cdot \tfrac 12(7r+13)=240\] from which $r^2+4r-5 =0$ , with roots $r=1$ and $r=-5$
If $r = 1$ , then the roots of $p(x)$ are $r=1$ $s=9$ , and $-(r+s)=-10$ , and $b=-rst=90$
If $r = -5$ , then the roots of $p(x)$ are $r=-5$ $s=-6$ , and $-(r+s)=11$ , and $b=-rst=-330$
Therefore the requested sum is $|- 330| + |90| = \boxed{420}$

Answer:  420
Problem: Real numbers $r$ and $s$ are roots of $p(x)=x^3+ax+b$ , and $r+4$ and $s-3$ are roots of $q(x)=x^3+ax+b+240$ . Find the sum of all possible values of $|b|$

Solution: Let $r$ $s$ , and $-r-s$ be the roots of $p(x)$ (per Vieta's). Then $r^3 + ar + b = 0$ and similarly for $s$ . Also, \[q(r+4) = (r+4)^3 + a(r+4) + b  + 240 = 12r^2 + 48r + 304 + 4a = 0\]
Set up a similar equation for $s$
\[q(s-3) = (s-3)^3 + a(s-3) + b + 240 = -9s^2 + 27s + 213 - 3a = 0.\]
Simplifying and adding the equations gives \begin{align}\tag{*} r^2 - s^2 + 4r + 3s + 49 &= 0 \end{align} Now, let's deal with the $ax$ terms. Plugging the roots $r$ $s$ , and $-r-s$ into $p(x)$ yields a long polynomial, and plugging the roots $r+4$ $s-3$ , and $-1-r-s$ into $q(x)$ yields another long polynomial. Equating the coefficients of $x$ in both polynomials, we get: \[rs + (-r-s)(r+s) = (r+4)(s-3) + (-r-s-1)(r+s+1),\] which eventually simplifies to \[s = \frac{13 + 5r}{2}.\] Substitution into (*) should give $r = -5$ and $r = 1$ , corresponding to $s = -6$ and $s = 9$ , and $|b| = 330, 90$ , for an answer of $\boxed{420}$

Answer:  420
Problem: Real numbers $r$ and $s$ are roots of $p(x)=x^3+ax+b$ , and $r+4$ and $s-3$ are roots of $q(x)=x^3+ax+b+240$ . Find the sum of all possible values of $|b|$

Solution: The roots of $p(x)$ are $r$ $s$ , and $-r-s$ since they sum to $0$ by Vieta's Formula (co-efficient of $x^2$ term is $0$ ).
Similarly, the roots of $q(x)$ are $r + 4$ $s - 3$ , and $-r-s-1$ , as they too sum to $0$
Then:
$a = rs+r(-r-s)+s(-r-s) = rs-(r+s)^2$ and $-b = rs(-r-s)$ from $p(x)$ and
$a=(r+4)(s-3)+(r+4)(-r-s-1)+(s-3)(-r-s-1) = (r+4)(s-3)-(r+s+1)^2$ and $-(b+240)=(r+4)(s-3)(-r-s-1)$ from $q(x)$
From these equations, we can write that \[rs-(r+s)^2 = (r+4)(s-3)-(r+s+1)^2 = a\] and simplifying gives \[2s-5r-13=0 \Rightarrow s = \frac{5r+13}{2}.\]
We now move to the other two equations regarding the product of the roots. We see that we can cancel a negative from both sides to get \[rs(r+s) = b\] \[(r+4)(s-3)(r+s+1)=b + 240.\] Subtracting the first equation from the second equation gives us $(r+4)(s-3)(r+s+1) - rs(r+s) = 240$
Expanding, simplifying, substituting $s = \frac{5r+13}{2}$ , and simplifying some more yields the simple quadratic $r^2 + 4r - 5 = 0$ , so $r = -5, 1$ . Then $s = -6, 9$
Finally, we substitute back into $b=rs(r+s)$ to get $b = (-5)(-6)(-5-6) = -330$ , or $b = (1)(9)(1 + 9) = 90$
The answer is $|-330|+|90| = \boxed{420}$

Answer:  420
Problem: Real numbers $r$ and $s$ are roots of $p(x)=x^3+ax+b$ , and $r+4$ and $s-3$ are roots of $q(x)=x^3+ax+b+240$ . Find the sum of all possible values of $|b|$

Solution: By Vieta's, we know that the sum of roots of $p(x)$ is $0$ . Therefore,
the roots of $p$ are $r, s, -r-s$ . By similar reasoning, the roots of $q(x)$ are $r + 4, s - 3, -r - s - 1$ . Thus, $p(x) = (x - r)(x - s)(x + r + s)$ and $q(x) = (x - r - 4)(x - s + 3)(x + r + s + 1)$
Since $p(x)$ and $q(x)$ have the same coefficient for $x$ , we can go ahead
and match those up to get \begin{align*}     rs - r(r + s) - s(r + s) &= (r + 4)(s - 3) - (r + 4)(r + s + 1) - (s - 3)(r + s + 1) \\     0 &= -13 - 5r + 2s \\     s &= \frac{5r + 13}{2} \end{align*}
At this point, we can go ahead and compare the constant term in $p(x)$ and $q(x)$ . Doing so is certainly valid, but we can actually do this another way. Notice that $p(s) = 0$ . Therefore, $q(s) = 240$ . If we plug that into
our expression, we get that \begin{align*}     q(s)  &= 3(s - r - 4)(r + 2s + 1) \\     240 &= 3(s - r - 4)(r + 2s + 1) \\     240 &= 3\left( \frac{3r + 5}{2} \right)(6r + 14) \\     80 &= (3r + 5)(3r + 7) \\     0 &= r^2 + 4r - 5 \end{align*} This tells us that $(r, s) = (1, 9)$ or $(-5, -6)$ . Since $-b$ is the product of the roots, we have that the two possibilities are $1 \cdot 9 \cdot (-10) = -90$ and $(-5)(-6)11 = 330$ . Adding the absolute values of these gives us $\boxed{420}$

Answer:  420
Problem: Charles has two six-sided die. One of the die is fair, and the other die is biased so that it comes up six with probability $\frac{2}{3}$ and each of the other five sides has probability $\frac{1}{15}$ . Charles chooses one of the two dice at random and rolls it three times. Given that the first two rolls are both sixes, the probability that the third roll will also be a six is $\frac{p}{q}$ , where $p$ and $q$ are relatively prime positive integers. Find $p+q$

Solution: The probability that he rolls a six twice when using the fair die is $\frac{1}{6}\times \frac{1}{6}=\frac{1}{36}$ .  The probability that he rolls a six twice using the biased die is $\frac{2}{3}\times \frac{2}{3}=\frac{4}{9}=\frac{16}{36}$ .  Given that Charles rolled two sixes, we can see that it is $16$ times more likely that he chose the second die.  Therefore the probability that he is using the fair die is $\frac{1}{17}$ , and the probability that he is using the biased die is $\frac{16}{17}$ .  The probability of rolling a third six is
\[\frac{1}{17}\times \frac{1}{6} + \frac{16}{17} \times \frac{2}{3} = \frac{1}{102}+\frac{32}{51}=\frac{65}{102}\] Therefore, our desired $p+q$ is $65+102= \boxed{167}$

Answer:  167
Problem: Charles has two six-sided die. One of the die is fair, and the other die is biased so that it comes up six with probability $\frac{2}{3}$ and each of the other five sides has probability $\frac{1}{15}$ . Charles chooses one of the two dice at random and rolls it three times. Given that the first two rolls are both sixes, the probability that the third roll will also be a six is $\frac{p}{q}$ , where $p$ and $q$ are relatively prime positive integers. Find $p+q$

Solution: This is an incredibly simple problem if one is familiar with conditional probability (SO BE FAMILIAR WITH IT)! 
The conditional probability that the third roll will be a six given that the first two rolls are sixes, is the conditional probability that Charles rolls three sixes given that his first two rolls are sixes. This is thus $\frac{\frac{1}{2}(\frac{2}{3})^3+\frac{1}{2}(\frac{1}{6})^3}{\frac{1}{2}(\frac{2}{3})^2+\frac{1}{2}(\frac{1}{6})^2}= \frac{65}{102}$ . The answer is therefore $65+102= \boxed{167}$

Answer:  167
Problem: Let $f(x)=(x^2+3x+2)^{\cos(\pi x)}$ . Find the sum of all positive integers $n$ for which \[\left |\sum_{k=1}^n\log_{10}f(k)\right|=1.\]

Solution: First, let's split it into two cases to get rid of the absolute value sign
$\left |\sum_{k=1}^n\log_{10}f(k)\right|=1 \iff \sum_{k=1}^n\log_{10}f(k)=1,-1$
Now we simplify using product-sum logarithmic identites:
$\log_{10}{f(1)}+\log_{10}{f(2)}+...+\log_{10}{f(n)}=\log_{10}{f(1)\cdot f(2) \cdot ... \cdot f(n)}=1,-1$
Note that the exponent $\cos{\pi(x)}$ is either $-1$ if $x$ is odd or $1$ if $x$ is even.
Writing out the first terms we have
$\frac{1}{(2)(3)}(3)(4)\frac{1}{(4)(5)} \ldots$
This product clearly telescopes (i.e. most terms cancel) and equals either $10$ or $\frac{1}{10}$ . But the resulting term after telescoping depends on parity (odd/evenness), so we split it two cases, one where $n$ is odd and another where $n$ is even.
$\textbf{Case 1: Odd n}$
For odd $n$ , it telescopes to $\frac{1}{2(n+2)}$ where $n$ is clearly $3$
$\textbf{Case 2: Even n}$
For even $n$ , it telescopes to $\frac{n+2}{2}$ where $18$ is the only possible $n$ value. Thus the answer is $\boxed{021}$

Answer:  021
Problem: Let $f(x)=(x^2+3x+2)^{\cos(\pi x)}$ . Find the sum of all positive integers $n$ for which \[\left |\sum_{k=1}^n\log_{10}f(k)\right|=1.\]

Solution: Note that $\cos(\pi x)$ is $-1$ when $x$ is odd and $1$ when $x$ is even.  Also note that $x^2+3x+2=(x+1)(x+2)$ for all $x$ .  Therefore \[\log_{10}f(x)=\log_{10}(x+1)+\log_{10}(x+2)\ \ \ \text{if }x \text{ is even}\] \[\log_{10}f(x)=-\log_{10}(x+1)-\log_{10}(x+2)\ \ \ \text{if }x \text{ is odd}\] Because of this, $\sum_{k=1}^n\log_{10}f(k)$ is a telescoping series of logs, and we have \[\sum_{k=1}^n\log_{10}f(k)= \log_{10}(n+2)-\log_{10}2=\log_{10}\frac{n+2}{2}\ \ \ \text{if }n \text{ is even}\] \[\sum_{k=1}^n\log_{10}f(k)= -\log_{10}(n+2)-\log_{10}2=-\log_{10}2(n+2)\ \ \ \text{if }n \text{ is odd}\] Setting each of the above quantities to $1$ and $-1$ and solving for $n$ , 
we get possible values of $n=3$ and $n=18$ so our desired answer is $3+18=\boxed{021}$

Answer:  021
Problem: Circle $C$ with radius 2 has diameter $\overline{AB}$ . Circle D is internally tangent to circle $C$ at $A$ . Circle $E$ is internally tangent to circle $C$ , externally tangent to circle $D$ , and tangent to $\overline{AB}$ . The radius of circle $D$ is three times the radius of circle $E$ , and can be written in the form $\sqrt{m}-n$ , where $m$ and $n$ are positive integers. Find $m+n$

Solution: Using the diagram above, let the radius of $D$ be $3r$ , and the radius of $E$ be $r$ . Then, $EF=r$ , and $CE=2-r$ , so the Pythagorean theorem in $\triangle CEF$ gives $CF=\sqrt{4-4r}$ . Also, $CD=CA-AD=2-3r$ , so \[DF=DC+CF=2-3r+\sqrt{4-4r}.\] Noting that $DE=4r$ , we can now use the Pythagorean theorem in $\triangle DEF$ to get \[(2-3r+\sqrt{4-4r})^2+r^2=16r^2.\]
Solving this quadratic is somewhat tedious, but the constant terms cancel, so the computation isn't terrible. Solving gives $3r=\sqrt{240}-14$ for a final answer of $\boxed{254}$

Answer:  254
Problem: Circle $C$ with radius 2 has diameter $\overline{AB}$ . Circle D is internally tangent to circle $C$ at $A$ . Circle $E$ is internally tangent to circle $C$ , externally tangent to circle $D$ , and tangent to $\overline{AB}$ . The radius of circle $D$ is three times the radius of circle $E$ , and can be written in the form $\sqrt{m}-n$ , where $m$ and $n$ are positive integers. Find $m+n$

Solution: Consider a reflection of circle $E$ over diameter $\overline{AB}$ . By symmetry, we now have three circles that are pairwise externally tangent and all internally tangent to a large circle. The small circles have radii $r$ $r$ , and $3r$ , and the big circle has radius $2$
Descartes' Circle Theorem gives $\left(\frac{1}{r}+\frac{1}{r}+\frac{1}{3r}-\frac12\right)^2 = 2\left(\left(\frac{1}{r}\right)^2+\left(\frac{1}{r}\right)^2+\left(\frac{1}{3r}\right)^2+\left(-\frac12\right)^2\right)$
Note that the big circle has curvature $-\frac12$ because it is internally tangent. 
Solving gives $3r=\sqrt{240}-14$ for a final answer of $\boxed{254}$

Answer:  254
Problem: Circle $C$ with radius 2 has diameter $\overline{AB}$ . Circle D is internally tangent to circle $C$ at $A$ . Circle $E$ is internally tangent to circle $C$ , externally tangent to circle $D$ , and tangent to $\overline{AB}$ . The radius of circle $D$ is three times the radius of circle $E$ , and can be written in the form $\sqrt{m}-n$ , where $m$ and $n$ are positive integers. Find $m+n$

Solution: We use the notation of Solution 1 for triangle $\triangle DEC$ \[\sin \angle EDC = \frac {EF}{DE} = \frac {1}{4} \implies \cos \angle EDC =  \frac {\sqrt{15}}{4}.\] We use Cosine Law for $\triangle DEC$ and get: \[(4r)^2 +(2 – 3r)^2 – 2 \cdot 4r \cdot (2 – 3r) \cdot  \frac {\sqrt{15}}{4} = (2 – r)^2\] \[(24 + 6 \sqrt{15} ) r^2 = (8 + 4 \sqrt {15})r \implies 3r = 4 \sqrt{15} – 14 \implies \boxed{254}.\] vladimir.shelomovskii@gmail.com, vvsss

Answer:  254