Answer: 899.0

For each even positive integer $x$ , let $g(x)$ denote the greatest power of 2 that divides $x.$ For example, $g(20)=4$ and $g(16)=16.$ For each positive integer $n,$ let $S_n=\sum_{k=1}^{2^{n-1}}g(2k).$ Find the greatest integer $n$ less than 1000 such that $S_n$ is a perfect square

Solution:
Given $g : x \mapsto \max_{j : 2^j | x} 2^j$ , consider $S_n = g(2) + \cdots + g(2^n)$ . Define $S = \{2, 4, \ldots, 2^n\}$ . There are $2^0$ elements of $S$ that are divisible by $2^n$ $2^1 - 2^0 = 2^0$ elements of $S$ that are divisible by $2^{n-1}$ but not by $2^n, \ldots,$ and $2^{n-1}-2^{n-2} = 2^{n-2}$ elements of $S$ that are divisible by $2^1$ but not by $2^2$
Thus \begin{align*} S_n &= 2^0\cdot2^n + 2^0\cdot2^{n-1} + 2^1\cdot2^{n-2} + \cdots + 2^{n-2}\cdot2^1\\ &= 2^n + (n-1)2^{n-1}\\ &= 2^{n-1}(n+1).\end{align*} Let $2^k$ be the highest power of $2$ that divides $n+1$ . Thus by the above formula, the highest power of $2$ that divides $S_n$ is $2^{k+n-1}$ . For $S_n$ to be a perfect square, $k+n-1$ must be even. If $k$ is odd, then $n+1$ is even, hence $k+n-1$ is odd, and $S_n$ cannot be a perfect square. Hence $k$ must be even. In particular, as $n<1000$ , we have five choices for $k$ , namely $k=0,2,4,6,8$
If $k=0$ , then $n+1$ is odd, so $k+n-1$ is odd, hence the largest power of $2$ dividing $S_n$ has an odd exponent, so $S_n$ is not a perfect square.
In the other cases, note that $k+n-1$ is even, so the highest power of $2$ dividing $S_n$ will be a perfect square. In particular, $S_n$ will be a perfect square if and only if $(n+1)/2^{k}$ is an odd perfect square.
If $k=2$ , then $n<1000$ implies that $\frac{n+1}{4} \le 250$ , so we have $n+1 = 4, 4 \cdot 3^2, \ldots, 4 \cdot 13^2, 4\cdot 3^2 \cdot 5^2$
If $k=4$ , then $n<1000$ implies that $\frac{n+1}{16} \le 62$ , so $n+1 = 16, 16 \cdot 3^2, 16 \cdot 5^2, 16 \cdot 7^2$
If $k=6$ , then $n<1000$ implies that $\frac{n+1}{64}\le 15$ , so $n+1=64,64\cdot 3^2$
If $k=8$ , then $n<1000$ implies that $\frac{n+1}{256}\le 3$ , so $n+1=256$
Comparing the largest term in each case, we find that the maximum possible $n$ such that $S_n$ is a perfect square is $4\cdot 3^2 \cdot 5^2 - 1 = \boxed{899}$

Solution:
First note that $g(k)=1$ if $k$ is odd and $2g(k/2)$ if $k$ is even.
so $S_n=\sum_{k=1}^{2^{n-1}}g(2k). = \sum_{k=1}^{2^{n-1}}2g(k) = 2\sum_{k=1}^{2^{n-1}}g(k) = 2\sum_{k=1}^{2^{n-2}} g(2k-1)+g(2k).$ $2k-1$ must be odd so this reduces to $2\sum_{k=1}^{2^{n-2}}1+g(2k) = 2(2^{n-2}+\sum_{k=1}^{2^n-2}g(2k)).$ Thus $S_n=2(2^{n-2}+S_{n-1})=2^{n-1}+2S_{n-1}.$ Further noting that $S_0=1$ we can see that $S_n=2^{n-1}\cdot (n-1)+2^n\cdot S_0=2^{n-1}\cdot (n-1)+2^{n-1}\cdot2=2^{n-1}\cdot (n+1).$ which is the same as above.  To simplify the process of finding the largest square $S_n$ we can note that if $n-1$ is odd then $n+1$ must be exactly divisible by an odd power of $2$ .  However, this means $n+1$ is even but it cannot be.  Thus $n-1$ is even and $n+1$ is a large even square.  The largest even square $< 1000$ is $900$ so $n+1= 900 => n= \boxed{899}$

Solution:
At first, this problem looks kind of daunting, but we can easily solve this problem by finding patterns, recursion and algebraic manipulations.
We first simplify all the messy notation in the $S_n$ term. Note that the problem asks us to find the smallest value of $n<1000$ such that there exists an integer $k$ that satisfies
\[k^2 = g(2) + g(4) + \cdots + g(2^n)\]
Since there is no obvious way to approach this problem, we start by experimenting with small values of $n$ to evaluate some $S_n$
We play with these values:
\[S_1 = g(2) = 2\]
\[S_2 = g(2) + g(4) = 2+4 = 6\]
\[S_3 = g(2) + g(4) + g(6) + g(8) = 16\]
\[S_4 =  g(2) + g(4) + g(6) + g(8) + g(10) +g(12)+g(14)+g(16) = 40\]
We are certainly not going to expand all of this out... so let's look for patterns from these $4$ values!
Using a little bit of ingenuity, we note that
\[S_2 = 2+4 = S_1 + 4\]
\[S_3 = 2+4+2+8 = 8+8 = S_2 + S_1 + 8\]
\[S_4 = 2+4+2+8+2+4+2+16 = S_3 + S_2 + S_1 + 16\]
Aha! We see powers of two in each of our terms! Therefore, we can say that
\[S_2 = S_1 + 2^2\]
\[S_3 = S_2+S_1 + 2^3\]
\[S_4 = S_3 + S_2 + S_1 + 2^4\]
Hooray! We have a recursion! Realistically, we would want to prove that the recursion works, but I currently don't know how to prove it.
On the actual AIME, go with whatever patterns you see, because most likely those are the patterns that the test-makers want the students to see.
So we may generalize a formula for $S_n$
\[S_n = 2^n + S_{n-1} + S_{n-2} + \cdots + S_2 + S_1\]
Uh oh... this formula is not in closed form. Looks like we'll have to use our recursion to develop one manually. We do so by using our recursion for $S_{n-1}$
\[S_n = 2^n + (2^{n-1} + S_{n-2} + S_{n-3} + \cdots + S_2 + S_1) + S_{n-2} + S_{n-3} + \cdots + S_2 + S_1\]
\[S_n = 2^n + 2^{n-1} + 2 (S_{n-2} + S_{n-3} + \cdots + S_2 + S_1\]
Let's simplify a bit further, where we use our recursion for $S_{n-2}$
\[S_n = 2^n + 2^{n-1} +(2S_{n-2}) + 2(S_{n-3} + S_{n-4} + \cdots + S_2 + S_1)\]
\[S_n = 2^n + 2^{n-1} + 2(2^{n-2}) + 2(S_{n-3} + S_{n-4} + \cdots + S_2 + S_1) + 2(S_{n-3} + S_{n-4} + \cdots + S_2 + S_1)\]
\[S_n = 2^n + 2^{n-1} + 2^{n-1} + 4(S_{n-3} + S_{n-4} + \cdots + S_2 + S_1)\]
We now see a pattern! Using the exact same logic, we can condense this whole messy thing into a closed form:
\[S_n = 2^n + \underbrace{2^{n-1}}_{n-2} + 2^{n-2}(S_1)\]
\[S_n = 2^n + 2^{n-1}(n-2) + 2^{n-1}\]
\[S_n = 2^n + 2^{n-1}(n-1)\]
\[S_n = 2^{n-1}(2 + (n-1)\]
\[S_n = 2^{n-1}(n+1)\]
We have our closed form, so now we can find the largest value of $n$ such that $S_n$ is a perfect square.
In order for $S_n$ to be a perfect square, we must have $n-1$ even and $n+1$ be a perfect square.
Since $n<1000$ , we have $n+1 < 1001$ . We first try $n+1 = 31^2 = 961$ (since it is the smallest square below $1000$ , which gives us $n=960$ . But $n-1$ isn't even, so we discard this value.
Next, we try the second smallest value, which is $n = 30^2 = 900$ , which tells us that $n=899$ $n-1$ is indeed even, and $n+1$ is a perfect square, so the largest value of $n$ such that $S_n$ is a perfect square is $899$
Our answer is $\boxed{899}$

Solution:
First, we set intervals. Say that a number $N$ falls strictly within $[2^k, 2^{k+1}]$
$N<2^{k+1}=2^k+2^k$
We can generalize this:
If a number is in the form $N=2^k+2^{R}O$ where $O$ is a positive odd number, $R<k$
$N<2^{k+1}=2^k+2^k\Longrightarrow O<2^{k-R}$ so there are $2^{k-R-1}$ numbers that satisfy this form.
For all numbers that satisfy this form, $g(N)=2^R$ . The sum of $g(N)$ for all $N$ in this form and interval is $2^{k-1}$ $R$ can vary between $1$ and $k-1$ , so the total sum is $\underbrace{2^{k-1}+2^{k-1}\cdots 2^{k-1}}_{k-1}=(k-1)2^{k-1}$ . The domain of the function we are trying to find is all even integers in the interval $[2^1, 2^n]$ so there are $n-1$ values of $k$ . Now we have the sum $\sum_{k=1}^{n-1}{(k-1)2^{k-1}}=\sum_{i=1}^{n-2}{k\cdot2^{k}}$ . However, we did not consider powers of two yet(since our interval was strictly between powers of 2), so we have to add $\sum_{k=1}^{n}{2^k}$ .
Note that $\sum_{i=1}^{n-2}{k\cdot2^{k}}=(2^1+2^2\cdots 2^{n-2})+(2^2+2^3\cdots 2^{n-2})\cdots +(2^{n-3}+2^{n-2})+2^{n-2}=2^1(2^{n-2}-1)+2^2(2^{n-3}-1)\cdots +2^{n-3}(2^2-1)+2^{n-2}(2^1-1)=(n-2)(2^{n-1})-\sum_{k=1}^{n-2}{2^k}=(n-2)(2^{n-1})-2(2^{n-2}-1)=(n-3)(2^{n-1})+2$ . Adding $\sum_{k=1}^{n}{2^k}=2(2^n-1)$ , we get $(n+1)(2^{n-1})$ .
If this sum is a perfect square, $n\not\equiv0\pmod2$ , since that would make $2^{n-1}$ not a perfect square, and $n+1$ odd so it cannot contribute a factor of 2 to make the power of 2 a perfect square.
We want the least odd number less than $1000$ such that $(n+1)$ is an even perfect square. The greatest even square less than $1000$ is $30^2=900$ so $n+1=900 \Longrightarrow n=\boxed{899}$


Answer: 483.0

For each integer $n \ge 2$ , let $A(n)$ be the area of the region in the coordinate plane defined by the inequalities $1\le x \le n$ and $0\le y \le x \left\lfloor \sqrt x \right\rfloor$ , where $\left\lfloor \sqrt x \right\rfloor$ is the greatest integer not exceeding $\sqrt x$ . Find the number of values of $n$ with $2\le n \le 1000$ for which $A(n)$ is an integer.

Solution:
Let $n\ge 2$ and define $a(n) = \left\lfloor \sqrt n \right\rfloor$ . For $2\le n \le 1000$ , we have $1\le a(n)\le 31$
For $a^2 \le x < (a+1)^2$ we have $y=ax$ . Thus $A(n+1)-A(n)=a(n+\tfrac 12) = \Delta_n$ (say), and $\Delta_n$ is an integer if $a$ is even; otherwise $\Delta_n$ is an integer plus $\tfrac 12$
If $a=1$ $n\in \{1,2,3\}$ and $\Delta_n$ is of the form $k(n)+\tfrac 12$ so $A(n)$ is an integer when $n$ is even.
If $a=2$ $n\in\{4,\ldots , 8\}$ and $\Delta_n$ is an integer for all $n$ . Since $A(3)$ is not an integer, so $A(n)$ is not an integer for any $n$
If $a=3$ $n\in\{9,\ldots , 15\}$ and $\Delta_n$ is of the form $k(n)+\tfrac 12$ . Since $A(8)$ is of the form $k+\tfrac 12$ so $A(n)$ is an integer only when $n$ is odd.
If $a=4$ $n\in\{16,\ldots , 24\}$ and $\Delta_n$ is an integer for all $n$ . Since $A(15)$ is an integer so $A(n)$ is an integer for all $n$
Now we are back to where we started; i.e., the case $a=5$ will be the same as $a=1$ and so on. Thus, \begin{align} a(n)\equiv 1\pmod 4 \qquad &\Longrightarrow \qquad A(n) \in \mathbb{Z} \textrm{ for even } n, \\ a(n)\equiv 2\pmod 4 \qquad &\Longrightarrow \qquad A(n) \not\in \mathbb{Z} \textrm{  for any } n, \\ a(n)\equiv 3\pmod 4 \qquad &\Longrightarrow \qquad A(n) \in \mathbb{Z} \textrm{ for odd  } n, \\ a(n)\equiv 0\pmod 4 \qquad &\Longrightarrow \qquad A(n) \in \mathbb{Z} \textrm{ for all } n. \end{align}
For each $a$ there are $2a+1$ corresponding values of $n$ : i.e., $n\in \{a^2, \ldots , (a+1)^2-1\}$
Thus, the number of values of $n$ corresponding to $(4)$ (i.e., $a(n)\equiv 0\pmod 4$ ) is given by \[\sum_{\substack{a=4k \\ a\le 31}}(2a+1) = \sum_{k=1}^7 (8k+1)=231.\]
The cases $(1)$ and $(3)$ combine to account for half the values of $n$ corresponding to odd values of $a(n)$ ; i.e., \[\frac 12 \cdot \sum_{\substack{a=2k+1 \\ a\le 31}} (2a+1) = \sum_{k=0}^{15} (2k+\tfrac 32) = 264\] However, this also includes the odd integers in $\{1001, \ldots , 1023\}$ . Subtracting $12$ to account for these, we get the  number of values of $n$ corresponding to cases $(1)$ and $(3)$ to be $264-12=252$
Adding the contributions from all cases we get our answer to be $231+252= \boxed{483}$

Solution: By considering the graph of this function, it is shown that the graph is composed of trapezoids ranging from $a^2$ to $(a+1)^2$ with the top made of diagonal line $y=ax$ . The width of each trapezoid is $3, 5, 7$ , etc. Whenever $a$ is odd, the value of $A(n)$ increases by an integer value, plus $\frac{1}{2}$ . Whenever $a$ is even, the value of $A(n)$ increases by an integer value. Since each trapezoid always has an odd width, every value of $n$ is not an integer when $a \pmod{4} \equiv 2$ , and is an integer when $a \pmod{4} \equiv 0$ . Every other value is an integer when $a$ is odd. Therefore, it is simply a matter of determining the number of values of $n$ where $a \pmod{4} \equiv 0$ $(5^2-4^2)+(9^2-8^2)+...+(29^2-28^2)$ ), and adding the number of values of $n$ where $a$ is odd ( $\frac{(2^2-1^2)+(4^2-3^2)+...+(30^2-29^2)+(1000-31^2)}{2}$ ). Adding the two values gives $231+252=\boxed{483}$

Solution:
First, draw a graph of the function. Note that it is just a bunch of line segments. Since we only need to know whether or not $A(n)$ is an integer, we can take the area of each piece from some $x$ to $x+1$ (mod 1), aka the piece from $2$ to $3$ has area $\frac{1}{2} (\mod 1)$ . There are some patterns. Every time we increase $n$ starting with $2$ , we either add $0 (\mod 1)$ or $\frac{1}{2} (\mod 1)$ . We look at $\lfloor \sqrt{x} \rfloor$ for inspiration. Every time this floor (which is really the slope) is odd, there is always an addition of $\frac{1}{2} (\mod 1)$ , and whenever that slope is even, that addition is zero.
Take a few cases. For slope $=1$ , we see that only one value satisfies. Because the last value, $n=4$ , fails, and the numbers $n$ which have a slope of an even number don't change this modulus, all these do not satisfy the criterion. The pattern then comes back to the odds, and this time $\lfloor \frac{7}{2} \rfloor + 1 = 4$ values work. Since the work/fail pattern alternates, all the $n$ s with even slope, $[17, 25]$ , satisfy the criterion. This pattern is cyclic over period 4 of slopes.
Even summation of working cases: $9+17+25+...+57 = 231$ .
Odd summation: $1+4+5+8+9+12...+29$ and plus the $20$ cases from $n=[962, 1000]$ $252$ . Answer is $\boxed{483}$


Answer: 197.0

For each integer $n\geq 2$ , let $S_n$ be the sum of all products $jk$ , where $j$ and $k$ are integers and $1\leq j<k\leq n$ . What is the sum of the 10 least values of $n$ such that $S_n$ is divisible by $3$
$\textbf{(A)}\ 196\qquad\textbf{(B)}\ 197\qquad\textbf{(C)}\ 198\qquad\textbf{(D)}\ 199\qquad\textbf{(E)}\ 200$

Solution:
To get from $S_n$ to $S_{n+1}$ , we add $1(n+1)+2(n+1)+\cdots +n(n+1)=(1+2+\cdots +n)(n+1)=\frac{n(n+1)^2}{2}$
Now, we can look at the different values of $n$ mod $3$ . For $n\equiv 0\pmod{3}$ and $n\equiv 2\pmod{3}$ , then we have $\frac{n(n+1)^2}{2}\equiv 0\pmod{3}$ . However, for $n\equiv 1\pmod{3}$ , we have \[\frac{1\cdot {2}^2}{2}\equiv 2\pmod{3}.\]
Clearly, $S_2\equiv 2\pmod{3}.$ Using the above result, we have $S_5\equiv 1\pmod{3}$ , and $S_8$ $S_9$ , and $S_{10}$ are all divisible by $3$ . After $3\cdot 3=9$ , we have $S_{17}$ $S_{18}$ , and $S_{19}$ all divisible by $3$ , as well as $S_{26}, S_{27}, S_{28}$ , and $S_{35}$ . Thus, our answer is $8+9+10+17+18+19+26+27+28+35=27+54+81+35=162+35=\boxed{197} .$ -BorealBear

Solution:
Since we have a wonky function, we start by trying out some small cases and see what happens. If $j$ is $1$ and $k$ is $2$ , then there is one case. We have $2$ mod $3$ for this case. If $N$ is $3$ , we have $1 \cdot 2 + 1 \cdot 3 + 2 \cdot 3$ which is still $2$ mod $3$ . If $N$ is $4$ , we have to add $1 \cdot 4 + 2 \cdot 4 + 3 \cdot 4$ which is a multiple of $3$ , meaning that we are still at $2$ mod $3$ . If we try a few more cases, we find that when $N$ is $8$ , we get a multiple of $3$ . When $N$ is $9$ , we are adding $0$ mod $3$ , and therefore, we are still at a multiple of $3$
When $N$ is $10$ , then we get $0$ mod $3$ $10(1+2+3+...+9)$ which is $10$ times a multiple of $3$ . Therefore, we have another multiple of $3$ . When $N$ is $11$ , so we have $2$ mod $3$ . So, every time we have $-1$ mod $9$ $0$ mod $9$ , and $1$ mod $9$ , we always have a multiple of $3$ . Think about it: When $N$ is $1$ , it will have to be $0 \cdot 1$ , so it is a multiple of $3$ . Therefore, our numbers are $8, 9, 10, 17, 18, 19, 26, 27, 28, 35$ . Adding the numbers up, we get $\boxed{197}$

Solution:
Denote $A_{n, <} = \left\{ \left( j , k \right) : 1 \leq j < k \leq n \right\}$ $A_{n, >} = \left\{ \left( j , k \right) : 1 \leq k < j \leq n \right\}$ and $A_{n, =} = \left\{ \left( j , k \right) : 1 \leq j = k \leq n \right\}$
Hence, $\sum_{\left( j , k \right) \in A_{n,<}} jk = \sum_{\left( j , k \right) \in A_{n,>}} jk = S_n$
Therefore, \begin{align*} S_n & = \frac{1}{2} \left( \sum_{\left( j , k \right) \in A_{n,<}} jk = \sum_{\left( j , k \right) \in A_{n,>}} jk \right) \\ & = \frac{1}{2} \left( \sum_{1 \leq j, k \leq n} jk - {\left( j , k \right) \in A_{n,=}} jk \right) \\ & = \frac{1}{2} \left( \sum_{j=1}^n \sum_{k=1}^n jk - \sum_{j=1}^n j^2 \right) \\ & = \frac{1}{2} \left( \frac{n^2 \left( n + 1 \right)^2}{4} - \frac{n \left( n + 1 \right) \left( 2 n + 1 \right) }{6} \right) \\ & = \frac{\left( n - 1 \right) n \left( n + 1 \right) \left( 3 n + 2 \right)}{24} . \end{align*}
Hence, $S_n$ is divisible by 3 if and only if $\left( n - 1 \right) n \left( n + 1 \right) \left( 3 n + 2 \right)$ is divisible by $24 \cdot 3 = 8 \cdot 9$
First, $\left( n - 1 \right) n \left( n + 1 \right) \left( 3 n + 2 \right)$ is always divisible by 8. Otherwise, $S_n$ is not even an integer.
Second, we find conditions for $n$ , such that $\left( n - 1 \right) n \left( n + 1 \right) \left( 3 n + 2 \right)$ is divisible by 9.
Because $3 n + 2$ is not divisible by 3, it cannot be divisible by 9.
Hence, we need to find conditions for $n$ , such that $\left( n - 1 \right) n \left( n + 1 \right)$ is divisible by 9.
This holds of $n \equiv 0, \pm 1 \pmod{9}$
Therefore, the 10 least values of $n$ such that $\left( n - 1 \right) n \left( n + 1 \right)$ is divisible by 9 (equivalently, $S_n$ is divisible by 3) are 8, 9, 10, 17, 18, 19, 26, 27, 28, 35.
Their sum is 197.
Therefore, the answer is $\boxed{197}$


Answer: 962.0

For each integer $n\geq 4$ , let $a_n$ denote the base- $n$ number $0.\overline{133}_n$ . The product $a_4a_5\cdots a_{99}$ can be expressed as $\frac {m}{n!}$ , where $m$ and $n$ are positive integers and $n$ is as small as possible. What is $m$
$\text {(A)} 98 \qquad \text {(B)} 101 \qquad \text {(C)} 132\qquad \text {(D)} 798\qquad \text {(E)}962$

Solution:
Note that \[0.\overline{133}_n = \frac{n^2+3n+3}{n^3-1},\] by geometric series.
Thus, we're aiming to find the value of \[\prod_{k=4}^{99} \frac{k^2+3k+3}{k^3 - 1}.\] Expanding the product out, this is equivalent to \[\frac{4^2+3(4)+3}{4^3 - 1} \cdot \frac{5^2+3(5)+3}{5^3 - 1} \cdot \frac{6^2+3(6)+3}{6^3 - 1} \cdot ... \cdot \frac{99^2+3(99)+3}{99^3 - 1}.\] Note that the numerator of the $a$ th fraction and the denominator of the $a+1$ th fraction for $1 \leq a \leq 95$ cancel out to be $\frac{1}{a+3},$ since \[\frac{k^2 + 3k + 3}{(k+1)^3 - 1} = \frac{k^2 + 3k + 3}{k^3 + 3k^2 + 3k} = \frac{1}{k},\] by the binomial theorem on the the denominator of the aforementioned. Since this forms a telescoping series, our product is now equivalent to \[\frac{99^2 + 3(99) + 3}{4^3 - 1} \cdot \prod_{k=4}^{98} \frac{1}{k},\] which, after simplification gives $\frac{6}{98!} \cdot \frac{10101}{63} = \frac{962}{98!},$ giving an answer of $\boxed{962}.$


Answer: 245.0

For each integer $n\geq3$ , let $f(n)$ be the number of $3$ -element subsets of the vertices of the regular $n$ -gon that are the vertices of an isosceles triangle (including equilateral triangles). Find the sum of all values of $n$ such that $f(n+1)=f(n)+78$

Solution:
Considering $n \pmod{6}$ , we have the following formulas:
$n\equiv 0$ $\frac{n(n-4)}{2} + \frac{n}{3}$
$n\equiv 2, 4$ $\frac{n(n-2)}{2}$
$n\equiv 3$ $\frac{n(n-3)}{2} + \frac{n}{3}$
$n\equiv 1, 5$ $\frac{n(n-1)}{2}$
To derive these formulas, we note the following:
Any isosceles triangle formed by the vertices of our regular $n$ -sided polygon $P$ has its sides from the set of edges and diagonals of $P$ . Notably, as two sides of an isosceles triangle must be equal, it is important to use the property that same-lengthed edges and diagonals come in groups of $n$ , unless $n$ is even when one set of diagonals (those which bisect the polygon) comes in a group of $\frac{n}{2}$ . Three properties hold true of $f(n)$
When $n$ is odd there are $\frac{n(n-1)}{2}$ satisfactory subsets (This can be chosen with $n$ choices for the not-base vertex, and $\frac{n-1}{2}$ for the pair of equal sides as we have $n-1$ edges to choose from, and we must divide by 2 for over-count).*
When $n$ is even there are $\frac{n(n-2)}{2}$ satisfactory subsets (This can be chosen with $n$ choices for the not-base vertex, and $\frac{n-2}{2}$ for the pair of equal sides as we have $n-1$ edges to choose from, one of them which is not satisfactory (the bisecting edge), and we must divide by 2 for over-count).
When $n$ is a multiple of three we additionally over-count equilateral triangles, of which there are $\frac{n}{3}$ . As we count them three times, we are two times over, so we subtract $\frac{2n}{3}$
Considering the six possibilities $n \equiv 0,1,2,3,4,5 \pmod{6}$ and solving, we find that the only valid solutions are $n = 36, 52, 157$ , from which the answer is $36 + 52 + 157 = \boxed{245}$

Solution:
In the case that $n\equiv 0\pmod 3$ , there are $\frac{n}{3}$ equilateral triangles. We will now count the number of non-equilateral isosceles triangles in this case.
Select a vertex $P$ of a regular $n$ -gon. We will count the number of isosceles triangles with their vertex at $P$ . (In other words, we are counting the number of isosceles triangles $\triangle APB$ with $A, B, P$ among the vertices of the $n$ -gon, and $AP=BP$ .)
If the side $AP$ spans $k$ sides of the $n$ -gon (where $k<\frac{n}{2}$ ), the side $BP$ must span $k$ sides of the $n$ -gon, and, thus, the side $AB$ must span $n-2k$ sides of the $n$ -gon. As $\triangle ABP$ has three distinct vertices, the side $AB$ must span at least one side, so $n-2k \ge 1$ . Combining this inequality with the fact that $1\le k<\frac{n}{2}$ and $k\not = \frac{n}{3}$ (as $\triangle ABP$ cannot be equilateral), we find that there are $\lceil\frac{n}{2}\rceil-2$ possible $k$
As each of the $n$ vertices can be the vertex of a given triangle $\triangle ABP$ , there are $\left(\lceil \frac{n}{2} \rceil -2 \right)\cdot n$ non-equilateral isosceles triangles.
Adding in the $\frac{n}{3}$ equilateral triangles, we find that for $n\equiv 0\pmod 3$ $f(n) = \frac{n}{3}+\left(\lceil \frac{n}{2} \rceil -2\right)\cdot n$
On the other hand, if $n\equiv 1, 2\pmod 3$ , there are no equilateral triangles, and we may follow the logic of the paragraph above to find that $f(n)=\left(\lceil \frac{n}{2} \rceil -1\right)\cdot n$
We may now rewrite the given equation, based on the remainder $n$ leaves when divided by 3.
Case 1: $n\equiv 0\pmod 3$ The equation $f(n+1)=f(n)+78$ for this case is $\left(\lceil \frac{n+1}{2} \rceil -1\right)\cdot (n+1)=\frac{n}{3}+\left(\lceil \frac{n}{2} \rceil -2\right)\cdot n+78$
In this case, $n$ is of the form $6k$ or $6k+3$ , for some integer $k$
Subcase 1: $n=6k$ Plugging into the equation above yields $k=6\rightarrow n=36$
Subcase 2: $n=6k+3$ Plugging into the equation above yields $7k=75$ , which has no integer solutions.
Case 2: $n\equiv 1\pmod 3$ The equation $f(n+1)=f(n)+78$ for this case is $\left(\lceil \frac{n+1}{2} \rceil -1\right)\cdot (n+1)=\left(\lceil \frac{n}{2} \rceil -1\right)\cdot n+78$
In this case, $n$ is of the form $6k+1$ or $6k+4$ , for some integer $k$
Subcase 1: $n=6k+1$ In this case, the equation above yields $k=8\rightarrow n=52$
Subcase 2: $n=6k+4$ In this case, the equation above yields $k=26\rightarrow n=157$
Case 3: $n\equiv 2\pmod 3$ The equation $f(n+1)=f(n)+78$ for this case is $\frac{n+1}{3}+\left(\lceil \frac{n+1}{2} \rceil -2\right)\cdot (n+1)=\left(\lceil \frac{n}{2} \rceil -1\right)\cdot n+78$
In this case, $n$ is of the form $6k+2$ or $6k+5$ , for some integer $k$
Subcase 1: $n=6k+2$ The equation above reduces to $5k=77$ , which has no integer solutions.
Subcase 2: $n=6k+5$ The equation above reduces to $k=-80$ , which does not yield a positive integer solution for $n$
In summary, the possible $n$ are $36, 52, 157$ , which add to $\boxed{245}$

Solution:
We first notice that when a polygon has $s$ sides where $s\not\equiv 0\pmod{3}$ , there cannot exist any three vertices that form an equilateral triangle. Also, the parity of $s$ and $s+1$ also matters, since they influence how many isosceles triangles including equilateral triangles exist in the polygon. We can model an equation $2x+y=s$ , where the lines that are congruent connect the vertices that are $x$ vertices apart and the other line has vertices that are $y$ vertices apart. If $s$ is even, there are $\frac{s-2}{2}$ solutions for $(x,y)$ which would create a unique type of isosceles triangle. We subtract two since $y$ cannot be zero. If $s$ is odd, there are $\frac{s-1}{2}$ solutions for $(x,y)$ .
Next, we do casework on the congruence of $s\pmod{3}$ and the parody of $s$ using the information above:
Case 1:
$s\not\equiv 0\pmod{3}$ $s+1\not\equiv 0\pmod{3}$
$s$ is even, $s+1$ is odd
There are $\frac{s-2}{2}$ unique types of isosceles triangles in the polygon with $s$ sides. Each isosceles triangle has a unique point which connects the two congruent sides. Therefore, for each type of isosceles triangle, there exists $s$ of those triangles since the unique point can be any of the $s$ vertices. There are $\frac{s}{2}$ types of isosceles triangles in the polygon with $s+1$ sides and $s+1$ unique points for each type of triangle. Therefore, $\frac{s}{2}\cdot{(s+1)}-\frac{s-2}{2}\cdot{(s)}=78$ . Solving, we get $s=52$
Case 2:
$s\not\equiv 0\pmod{3}$ $s+1\not\equiv 0\pmod{3}$
$s$ is odd, $s+1$ is even
Using similar logic, there are $\frac{s-1}{2}\cdot{(s)}$ possible isosceles triangles in the $s$ sided polygon. There are $\frac{s-1}{2}\cdot{(s+1)}$ possible isosceles triangles in the $s+1$ sided polygon. The difference should be $78$ , so $\frac{s-1}{2}\cdot{(s+1)}-\frac{s-1}{2}\cdot{(s)}=78$ . Solving gives $s=157$
For both of these cases, we don't have to worry about equilateral triangles since in both cases $s,s+1\nmid3$
Case 3:
$s\not\equiv 0\pmod{3}$ $s+1\equiv 0\pmod{3}$
$s$ is even, $s+1$ is odd
There are $\frac{s-2}{2}\cdot{(s)}$ possible isosceles triangles in the $s$ sided polygon. The $s+1$ case is a bit more complicated, as we have to consider equilateral triangles as well. In this case, there is one solution where $x=y$ , which would produce an equilateral triangle. Therefore, we subtract that case to calculate only isosceles triangles with 2 congruent sides. Only isosceles triangles with exactly 2 congruent sides have a unique point, while there exist only $\frac{s+1}{3}$ distinct equilateral triangles in a polygon with $s+1$ sides, the rest are equivalent and symmetrical. Therefore, there are $(\frac{s}{2}-1)\cdot{(s+1)}+\frac{s+1}{3}$ isosceles triangles with at least 2 congruent sides in a polygon with $s+1$ sides. Putting it together, $\frac{s}{2}-1\cdot{(s+1)}+(\frac{s+1}{3})-\frac{s-2}{2}\cdot{(s)}=78$ . Solving yields $5s=772$ which is impossible since $s$ has to be an integer. Therefore, this case is not valid.
Case 4:
$s\not\equiv 0\pmod{3}$ $s+1\equiv 0\pmod{3}$
$s$ is odd, $s+1$ is even
There are $\frac{s-1}{2}\cdot{(s)}$ isosceles triangles in the $s$ sided polygon. Using the idea above, there are $(\frac{s-1}{2}-1)\cdot{(s+1)}$ isosceles triangles with 2 congruent sides in an $s+1$ sided polygon. There are $\frac{s+1}{3}$ equilateral triangles. Therefore, $(\frac{s-1}{2}-1)\cdot{(s+1)}+(\frac{s+1}{3})-\frac{s-1}{2}\cdot{(s)}=78$ . Looking at the left hand side, it is clear that $s$ has to be negative, which is not valid. Therefore, this case is not valid.
Case 5:
$s\equiv 0\pmod{3}$ $s+1\not\equiv 0\pmod{3}$
$s$ is even, $s+1$ is odd
There are a total of $(\frac{s-2}{2}-1)\cdot{(s)}+(\frac{s}{3})$ isosceles triangles in a polygon with $s$ sides. There are a total of $\frac{s}{2}\cdot{(s+1)}$ isosceles triangles in a polygon with $s+1$ sides. Therefore, $\frac{s}{2}\cdot{(s+1)}-(\frac{s-2}{2}-1)\cdot{(s)}-(\frac{s}{3})=78$ . Simplifying, we get $s=36$
Case 6:
$s\equiv 0\pmod{3}$ $s+1\not\equiv 0\pmod{3}$
$s$ is odd, $s+1$ is even
There are a total of $(\frac{s-1}{2}-1)\cdot{(s)}+(\frac{s}{3})$ isosceles triangles in the polygon with $s$ sides. There are $\frac{s-1}{2}\cdot{(s+1)}$ isosceles triangles in the polygon with $s+1$ sides. Therefore, $\frac{s-1}{2}\cdot{(s+1)}-(\frac{s-1}{2}-1)\cdot{(s)}-(\frac{s}{3})=78$ . Simplifying, we get $7s=471$ , which means $s$ is not an integer. Thus, this case is invalid.
Adding all the valid cases, we obtain $52+157+36=\boxed{245}$


Answer: 189.0

For each ordered pair of real numbers $(x,y)$ satisfying \[\log_2(2x+y) = \log_4(x^2+xy+7y^2)\] there is a real number $K$ such that \[\log_3(3x+y) = \log_9(3x^2+4xy+Ky^2).\] Find the product of all possible values of $K$

Solution: Using the logarithmic property $\log_{a^n}b^n = \log_{a}b$ , we note that \[(2x+y)^2 = x^2+xy+7y^2\] That gives \[x^2+xy-2y^2=0\] upon simplification and division by $3$ . Factoring $x^2+xy-2y^2=0$ gives \[(x+2y)(x-y)=0\] Then, \[x=y \text{ or }x=-2y\] From the second equation, \[9x^2+6xy+y^2=3x^2+4xy+Ky^2\] If we take $x=y$ , we see that $K=9$ . If we take $x=-2y$ , we see that $K=21$ . The product is $\boxed{189}$

Solution: Do as done in Solution 1 to get \[x^2+xy-2y^2=0\] \[\implies (\frac{x}{y})^2+\frac{x}{y}-2=0\] \[\implies \frac{x}{y}=\frac{-1\pm\sqrt{1+8}}{2}=1,-2\] Do as done in Solution 1 to get \[9x^2+6xy+y^2=3x^2+4xy+Ky^2\] \[\implies 6x^2+2xy+(1-K)y^2=0\] \[\implies 6(\frac{x}{y})^2+2\frac{x}{y}+(1-K)=0\] \[\implies \frac{x}{y}=\frac{-2\pm \sqrt{4-24(1-K)}}{12}\] \[\implies \frac{x}{y}=\frac{-2\pm 2\sqrt{6K-5}}{12}=\frac{-1\pm \sqrt{6K-5}}{6}\] If $\frac{x}{y}=1$ then \[1=\frac{-1\pm \sqrt{6K-5}}{6}\] \[\implies 6=-1\pm \sqrt{6K-5}\] \[\implies 7=\pm \sqrt{6K-5}\] \[\implies 49=6K-5\] \[\implies K=9\] If $\frac{x}{y}=-2$ then \[-2=\frac{-1\pm \sqrt{6K-5}}{6}\] \[\implies -12=-1\pm \sqrt{6K-5}\] \[\implies -11=\sqrt{6K-5}\] \[\implies 121=6K-5\] \[\implies 126=6K\] \[\implies K=21\] Hence our final answer is $21\cdot 9=\boxed{189}$ -vsamc $\newline$ -minor edit:einsteinstudent


Answer: 0.0

For each pair of real numbers $a \neq b$ , define the operation $\star$ as
$(a \star b) = \frac{a+b}{a-b}$
What is the value of $((1 \star 2) \star 3)$
$\textbf{(A) } -\frac{2}{3}\qquad \textbf{(B) } -\frac{1}{5}\qquad \textbf{(C) } 0\qquad \textbf{(D) } \frac{1}{2}\qquad \textbf{(E) } \textrm{This\, value\, is\, not\, defined.}$

Solution: $((1 \star 2) \star 3) = \left(\left(\frac{1+2}{1-2}\right) \star 3\right) = (-3 \star 3) = \frac{-3+3}{-3-3} = 0 \Longrightarrow \boxed{0}$


Answer: 58.0

For each permutation $a_1,a_2,a_3,\cdots,a_{10}$ of the integers $1,2,3,\cdots,10$ , form the sum
\[|a_1-a_2|+|a_3-a_4|+|a_5-a_6|+|a_7-a_8|+|a_9-a_{10}|.\]
The average value of all such sums can be written in the form $\dfrac{p}{q}$ , where $p$ and $q$ are relatively prime positive integers. Find $p+q$

Solution:
Because of symmetry, we may find all the possible values for $|a_n - a_{n - 1}|$ and multiply by the number of times this value appears. Each occurs $5 \cdot 8!$ , because if you fix $a_n$ and $a_{n + 1}$ there are still $8!$ spots for the others and you can do this $5$ times because there are $5$ places $a_n$ and $a_{n + 1}$ can be.
To find all possible values for $|a_n - a_{n - 1}|$ we have to compute \begin{eqnarray*} |1 - 10| + |1 - 9| + \ldots + |1 - 2|\\ + |2 - 10| + \ldots + |2 - 3| + |2 - 1|\\ + \ldots\\ + |10 - 9| \end{eqnarray*}
This is equivalent to
\[2\sum\limits_{k = 1}^{9}\sum\limits_{j = 1}^{k}j = 330\]
The total number of permutations is $10!$ , so the average value is $\frac {330 \cdot  8!  \cdot  5}{10!} = \frac {55}{3}$ , and $m+n = \boxed{058}$

Solution:
Without loss of generality , let $a_1 > a_2;\, a_3 > a_4;\, \ldots ;\, a_9 > a_{10}$ . We may do this because all sums obtained from these paired sequences are also obtained in another $2^5-1$ ways by permuting the adjacent terms $\{a_1,a_2\},\{a_3,a_4\}, \cdots , \{a_9, a_{10}\}$ , and thus are canceled when the average is taken.
So now we only have to form the sum $S= (a_1 + a_3 + a_5 + a_7 + a_9) - (a_2 + a_4 + a_6 + a_8 + a_{10})$ . Due to the symmetry of this situation, we only need to compute the expected value of the result. $10$ must always be the greatest number in its pair; $9$ will be the greater number in its pair $\frac{8}{9}$ of the time and the lesser number $\frac 19$ of the time; $8$ will be the greater number in its pair $\frac 79$ of the time and the lesser $\frac 29$ of the time; and so forth. Each number either adds or subtracts from the sum depending upon whether it is one of the five greater or five lesser numbers in the pairs, respectively. Thus
\begin{align*} \overline{S} &= 10 + \left(\frac{8}{9} \cdot 9\right) - \left(\frac{1}{9} \cdot 9\right) + \left(\frac{7}{9} \cdot 8\right) - \left(\frac 29 \cdot 8\right) + \cdots + \left(\frac{1}{9} \cdot 2\right) - \left(\frac{8}{9} \cdot 2\right) - 1 \\ &= \frac{9 \cdot 10 + 7 \cdot 9 + 5 \cdot 8 + 3 \cdot 7 + 1 \cdot 6 - 1 \cdot 5 - 3 \cdot 4 - 5 \cdot 3 - 7 \cdot 2 - 9 \cdot 1}{9} \\ &= \frac{55}{3} \end{align*}
And the answer is $m+n = \boxed{058}$

Solution:
Similar to Solution 1, we can find the average value of $|a_2 - a_1|$ , and multiply this by 5 due to symmetry.  And again due to symmetry, we can arbitrarily choose $a_2 > a_1$ .  Thus there are $\binom{10}{2} = 45$ ways to pick the two values of $a_2$ and $a_1$ from the set $\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}$ such that $a_2 > a_1$ .  First fix $a_2 = 10$ , and vary $a_1$ from $1$ to $9$ .  Then fix $a_2 = 9$ , and vary $a_1$ from $1$ to $8$ .  Continue, and you find that the sum of these $45$ ways to pick $|a_2 - a_1|$ is:
$\sum\limits_{k = 1}^{9}\sum\limits_{j = 1}^{k}j = 45+36+28+21+15+10+6+3+1 = 165$
Thus, each term contributes on average $\frac{165}{45}$ , and the sum will be five times this, or $\frac{165}{9} = \frac{55}{3}$
The final answer is $p+q = \boxed{058}$

Solution:
We use expected value of one of the sums, say $|a_2 - a_1|$ , since all five are similar, so the average or expected value of the sum is just 5 times the expected value of one of them.
To pick two random expected numbers from 1 to 10, we use a well known expected value trick by tying the two ends 1 and 10 with an extra number 0.* This gives 11 spaces, and we distribute 3 gaps evenly to choose our two numbers. We get $\frac{11}{3}$ and $\frac{22}{3}$ giving an absolute difference of $\frac{11}{3}$ . Therefore, the average/expected value of the sum of the five would be $\frac{55}{3}$ . This gives $55+3=\boxed{058}$


Answer: 12.0

For each positive integer $k$ , let $S_k$ denote the increasing arithmetic sequence of integers whose first term is $1$ and whose common difference is $k$ .  For example, $S_3$ is the sequence $1,4,7,10,\ldots.$ For how many values of $k$ does $S_k$ contain the term $2005$

Solution: Suppose that the $n$ th term of the sequence $S_k$ is $2005$ . Then $1+(n-1)k=2005$ so $k(n-1)=2004=2^2\cdot 3\cdot 167$ .  The ordered pairs $(k,n-1)$ of positive integers that satisfy the last equation are $(1,2004)$ $(2,1002)$ $(3,668)$ $(4,501)$ $(6,334)$ $(12,167)$ $(167,12)$ $(334,6)$ $(501,4)$ $(668,3)$ $(1002,2)$ and $(2004,1)$ , and each of these gives a possible value of $k$ . Thus the requested number of values is $12$ , and the answer is $\boxed{012}$

Solution:
Any term in the sequence $S_k$ can be written as 1+kx.  If this is to equal 2005, then the remainder when 2005 is divided by k is 1.
Now all we have to do is find the numbers of factors of 2004.  There are $(2 + 1)(1 + 1)(1 + 1) = \boxed{012}$ divisors of $2^2\cdot 3^1\cdot 167^1$


Answer: 1.0

For each positive integer $n > 1$ , let $P(n)$ denote the greatest prime factor of $n$ . For how many positive integers $n$ is it true that both $P(n) = \sqrt{n}$ and $P(n+48) = \sqrt{n+48}$
$\textbf{(A) } 0\qquad \textbf{(B) } 1\qquad \textbf{(C) } 3\qquad \textbf{(D) } 4\qquad \textbf{(E) } 5$

Solution:
If $P(n) = \sqrt{n}$ , then $n = p_{1}^{2}$ , where $p_{1}$ is a prime number
If $P(n+48) = \sqrt{n+48}$ , then $n + 48$ is a square, but we know that n is $p_{1}^{2}$
This means we just have to check for squares of primes, add $48$ and look whether the root is a prime number.
We can easily see that the difference between two consecutive square after $576$ is greater than or equal to $49$ ,
Hence we have to consider only the prime numbers till $23$
Squaring prime numbers below $23$ including $23$ we get the following list.
$4 , 9 , 25 , 49 , 121, 169 , 289 , 361 , 529$
But adding $48$ to a number ending with $9$ will result in a number ending with $7$ , but we know that a perfect square does not end in $7$ , so we can eliminate those cases to get the new list.
$4 , 25 , 121 , 361$
Adding $48$ , we get $121$ as the only possible solution.
Hence the answer is $\boxed{1}$


Answer: 9.0

For each positive integer $n$ , let
Let $k$ denote the smallest positive integer for which the rightmost nonzero digit of $a_k$ is odd. The rightmost nonzero digit of $a_k$ is
$\mathrm{(A) \ }1 \qquad \mathrm{(B) \ }3 \qquad \mathrm{(C) \ }5 \qquad \mathrm{(D) \ } 7 \qquad \mathrm{(E) \ } 9$

Solution:
We have $a_n = n(n+1)\dots (n+9)$
The value $a_n$ can be written as $2^{x_n} 5^{y_n} r_n$ , where $r_n$ is not divisible by 2 and 5. The number of trailing zeroes is $z_n = \min(x_n,y_n)$ . The last non-zero digit is the last digit of $2^{x_n-z_n} 5^{y_n-z_n} r_n$
Clearly, the last non-zero digit is even iff $x_n - z_n > 0$ iff $x_n > y_n$
Thus we are looking for the smallest $n$ such that the power of $5$ that divides $a_n$ is at least equal to the power of $2$ that divides $a_n$
The number $a_n$ is a product of $10$ consecutive integers. Out of these, $5$ are divisible by $2$ . Out of those $5$ , at least $2$ are divisible by $4$ , and out of those $2$ , one is divisible by $8$ . Therefore $x_n\geq 5+2+1=8$ for all $n$
On the other hand, exactly $2$ of our ten integers are divisible by $5$ , and at most one of them can be divisible by a higher power of $5$ . As we need $y_n\geq x_n\geq 8$ , one of the integers from $n$ to $n+9$ must be divisible by $5^7 = 78125$ . Therefore $n\geq 78116$
We can now take numbers starting with $78116$ , and write each of them in the form $2^x 5^y r$ . We are looking for 10 consecutive rows where the sum of $y$ s is at least equal to the sum of $x$ s.
At this point we can stop, as we just found out that $a_{78117}$ is of the form $2^8 5^8 r_{78117}$ . Therefore the $k$ we seek is $k=78117$
Now all we need to do is to compute the last non-zero digit. As the powers of $2$ and $5$ that divide $a_{78117}$ are equal, the last non-zero digit is simply the product of the last digits of the ten $z$ s. This is $7\cdot 9\cdot 9\cdot 3\cdot 1\cdot 1\cdot 3\cdot 1\cdot 1\cdot 3 \equiv\boxed{9}$


Answer: 8.0

For each positive integer $n$ , let $S(n)$ be the number of sequences of length $n$ consisting solely of the letters $A$ and $B$ , with no more than three $A$ s in a row and no more than three $B$ s in a row. What is the remainder when $S(2015)$ is divided by $12$
$\textbf{(A)}\ 0\qquad\textbf{(B)}\ 4\qquad\textbf{(C)}\ 6\qquad\textbf{(D)}\ 8\qquad\textbf{(E)}\ 10$

Solution:
The huge $n$ value in place, as well as the "no more than... in a row" are key phrases that indicate recursion is the right way to go.
Let's go with finding the case of $S(n)$ from previous cases.
So how can we make the words of $S(n)$ ? Do we choose 3-in-a-row of one letter, $A$ or $B$ , or do we want $2$ consecutive ones or $1$ ? Note that this covers all possible cases of ending with $A$ and $B$ with a certain number of consecutive letters. And obviously they are all distinct.
[Convince yourself that each case for $S(n)$ is considered exactly once by using these cues: does it end in $3$ $2$ , or $1$ consecutive letter(s) ( $1$ consecutive means a string like ... $BA$ , ... $AB$ , as in the letter switches) and does it $WLOG$ consider both $A$ and $B?$
From there we realize that $S(n)=S(n-1)+S(n-2)+S(n-3)$ because 3 in a row requires $S(n-3)$ , and so on. We need to find $S(2015)$ mod 12. We first compute $S(2015)$ mod $3$ and mod $4$ . By listing out the residues mod $3$ , we find that the cycle length for mod $3$ is $13$ $2015$ is $0$ mod $13$ so $S(2015) = S(13) = 2$ mod $3$ . By listing out the residues mod $4$ , we find that the cycle length for mod $4$ is $4$ . S(2015) = S(3) = mod $4$ . By Chinese Remainder Theorem, $S(2015) =\boxed{8}$ mod $12$

Solution: We can start off by finding patterns in $S(n)$ . When we calculate a few values we realize either from performing the calculation or because the calculation was performed in the exact same way that $S(n) = 2^n - 2((n_4)- (n_5) \dots (n_n))$ . Rearranging the expression we realize that the terms aside from $2^{2015}$ are congruent to $0$ mod $12$ (Just put the equation in terms of 2^{2015} and the four combinations excluded and calculate the combinations mod $12$ ). Using patterns we can see that $2^{2015}$ is congruent to $8$ mod $12$ . Therefore $\boxed{8}$ is our answer.


Answer: 4.0

For each positive integer $n$ , let $S(n)$ denote the sum of the digits of $n.$ For how many values of $n$ is $n + S(n) + S(S(n)) = 2007?$
$\mathrm{(A)}\ 1 \qquad \mathrm{(B)}\ 2 \qquad \mathrm{(C)}\ 3 \qquad \mathrm{(D)}\ 4 \qquad \mathrm{(E)}\ 5$

Solution:
It is well-known that $n \equiv S(n)\equiv S(S(n)) \pmod{9}.$ Substituting, we have that \[n+n+n \equiv 2007 \pmod{9} \implies n \equiv 0 \pmod{3}.\] Since $n \leq 2007,$ we must have that $\max S(n)=1+9+9+9=28.$ Now, we list out the possible vales for $S(n)$ in a table, noting that it is a multiple of $3$ because $n$ is a multiple of $3.$
Then, we compute the corresponding values of $S(S(n)).$
Finally, we may compute the corresponding values of $n$ using the fact that $n=2007-S(n)-S(S(n)).$
Notice how all conditions are designed to be satisfied except whether $S(n)$ is accurate with respect to $n.$ So, the only thing that remains is to check this. We may eliminate, for example, when $n=2007$ we have $S(n)=9$ while the table states that it is $0.$ Proceeding similarly, we obtain the following table.
It follows that there are $\boxed{4}$ possible values for $n.$ ~samrocksnature

Solution:
Let the number of digits of $n$ be $m$ . If $m = 5$ $n$ will already be greater than $2007$ . Notice that $S(n)$ is always at most $9m$ . Then if $m = 3$ $n$ will be at most $999$ $S(n)$ will be at most $27$ , and $S(S(n))$ will be even smaller than $27$ . Clearly we cannot reach a sum of $2007$ , unless $m = 4$ (i.e. $n$ has $4$ digits).
Then, let $n$ be a four digit number in the form $1000a + 100b + 10c + d$ . Then $S(n) = a + b + c + d$
$S(S(n))$ is the sum of the digits of $a + b + c + d$ . We can represent $S(S(n))$ as the sum of the tens digit and the ones digit of $S(n)$ . The tens digit in the form of a decimal is
$\frac{a + b + c + d}{10}$
To remove the decimal portion, we can simply take the floor of the expression,
$\lfloor\frac{a + b + c + d}{10}\rfloor$
Now that we have expressed the tens digit, we can express the ones digit as $S(n) -10$ times the above expression, or
$a + b + c + d - 10\lfloor\frac{a + b + c + d}{10}\rfloor$
Adding the two expressions yields the value of $S(S(n))$
$= a + b + c + d - 9\lfloor\frac{a + b + c + d}{10}\rfloor$
Combining this expression to the ones for $n$ and $S(n)$ yields
$1002a + 102b + 12c + 3d - 9\lfloor\frac{a + b + c + d}{10}\rfloor$
Setting this equal to $2007$ and rearranging a bit yields
$12c + 3d = 2007 - 1002a - 102b + 9\lfloor\frac{a + b + c + d}{10}\rfloor$
$\Rightarrow$ $4c + d = 669 - 334a - 34b + 3\lfloor\frac{a + b + c + d}{10}\rfloor$
(The reason for this slightly weird arrangement will soon become evident)
Now we examine the possible values of $a$ . If $a \ge 3$ $n$ is already too large. $a$ must also be greater than $0$ , or $n$ would be a $3$ -digit number. Therefore, $a = 1 \, \text{or} \, 2$ . Now we examine by case.
If $a = 2$ , then $b$ and $c$ must both be $0$ (otherwise $n$ would already be greater than $2007$ ). Substituting these values into the equation yields
$d = 1 + 3\lfloor\frac{2 + d}{10}\rfloor$
$\Rightarrow$ $d=1$
Sure enough, $2001 + (2+1) + 3=2007$
Now we move onto the case where $a = 1$ . Then our initial equation simplifies to
$4c + d = 335 - 34b + 3\lfloor\frac{1 + b + c + d}{10}\rfloor$
Since $c$ and $d$ can each be at most $9$ , we substitute that value to find the lower bound of $b$ . Doing so yields
$34b \ge 290 + 3\lfloor\frac{19 + b}{10}\rfloor$
The floor expression is at least $3\lfloor\frac{19}{10}\rfloor=3$ , so the right-hand side is at least $293$ . Solving for $b$ , we see that $b \ge 9$ $\Rightarrow$ $b=9$ . Again, we substitute for $b$ and the equation becomes
$4c + d = 29 + 3\lfloor\frac{10 + c + d}{10}\rfloor$
$\Rightarrow$ $4c + d = 32 + 3\lfloor\frac{c + d}{10}\rfloor$
Just like we did for $b$ , we can find the lower bound of $c$ by assuming $d = 9$ and solving:
$4c + 9 \ge 29 + 3\lfloor\frac{c + 9}{10}\rfloor$
$\Rightarrow$ $4c \ge 20 + 3\lfloor\frac{c + 9}{10}\rfloor$
The right hand side is $20$ for $c=0$ and $23$ for $c \ge 1$ . Solving for c yields $c \ge 6$ . Looking back at the previous equation, the floor expression is $0$ for $c+d \le 9$ and $3$ for $c+d \ge 10$ . Thus, the right-hand side is $32$ for $c+d \le 9$ and $35$ for $c+d \ge 10$ . We can solve these two scenarios as systems of equations/inequalities:
$4c+d = 32$
$c+d \le 9$
and
$4c+d=35$
$c+d \ge 10$
Solving yields three pairs $(c, d):$ $(8, 0)$ $(8, 3)$ ; and $(7, 7)$ . Checking the numbers $1980$ $1983$ , and $1977$ ; we find that all three work. Therefore there are a total of $4$ possibilities for $n$ $\Rightarrow$ $\boxed{4}$


Answer: 4.0

Solution:
Claim. The only positive integers $n$ that satisfy the condition are perfect multiples of $3$
Proof of claim:
We examine the positive integers mod $9$ . Here are the cases.
Case 1. $n \equiv 1 \pmod 9$ . Now, we examine $S(n)$ modulo $9$ .
Case 1.1. The tens digit of $n$ is different from the tens digit of the largest multiple of $9$ under $n$ . (In other words, this means we will carry when adding from the perfect multiple of $9$ under $n$ .)
Observe that when we carry, i.e. Add $1$ onto $1989$ to obtain $1990$ , the units digit decreases by $9$ while the tens digit increases by $1$ . This means that the sum of the digits decreases by $8$ in total, and we have $-8 \equiv 1 \pmod 9$ , so the "mod 9" of the sum increases by $1$ . This means that, regardless of whether the sum carries or not, the modulo 9 of the sum of the digits always increases by $1$
Case 1.2. The tens digits are the same, which is trivial since the units digit just increases by $1$ which means that the sum is also equivalent to $1 \pmod 9$
This means that $S(n) \equiv 1 \pmod 9$ and similarly letting the next $n=S(n)$ $S(S(n)) \equiv 1 \pmod 9$ . Summing these, we have $n+S(n)+S(S(n)) \equiv 3 \pmod 9$ . Clearly, no integers of this form will satisfy the condition because $2007$ is a perfect multiple of $9$
Case 2. $n \equiv 2 \pmod 9$
In this case, we apply exactly the same argument. There is at most one carry, which means that the sum of the digits will always be congruent to $2$ mod $9$ . Then we can apply similar arguments to get $S(n) \equiv 2 \pmod 9$ and $S(S(n)) \equiv 2 \pmod 9$ , so adding gives $n+S(n)+S(S(n)) \equiv 6 \pmod 9$
It is trivial to see that for $n \equiv k \pmod 9$ , for $0 \leq k \leq 8$ , we must have $n+S(n)+S(S(n)) \equiv 3k \pmod 9$ . Only when $k=0, 3, 6$ is $3k$ a multiple of $9$ , which means that $n$ must be a multiple of $3$
Now, we find the integers. Again, consider two cases: Integers that are direct multiples of $9$ and integers that are multiples of $3$ but not $9$
Case 1. $n$ is a multiple of $9$ . An integer of the form $\overline{20ab}$ will not work since the least such integer is $2007$ which already exceeds our bounds. Thus, we need only consider the integers of the form $\overline{19ab}$ . The valid sums of the digits of $n$ are $18$ and $27$ in this case.
Case 1.1. The sum of the digits is $18$ . This means that $S(n)=18, S(S(n))=9$ , so $n=2007-18-9=1980$ . Clearly this number satisfies our constraints.
Case 1.2. The sum of the digits is $27$ . This means that $S(n)=27, S(S(n))=9$ , ,so $n=2007-27-9=1971$ . Since the sum of the digits of $1971$ is not $27$ , this does not work.
This means that there is $1$ integer in this case.
Case 2. $n$ is a multiple of $3$ , not $9$ .
.
Case 2.1. Integers of the form $\overline{20ab}$ . Then $S(n)=3$ or $S(n)=6$ ; it is trivial to see that $S(n)=6$ exceeds our bounds, so $S(n)=3$ and $n=2007-6=2001$
Case 2.2. Integers of the form $\overline{19ab}$ . Then $S(n)=12, 15, 21, 24$ and we consider each case separately.
Case 2.2.1. Integers with $S(n)=12$ . That means $n=2007-12-3=1992$ which clearly does not work.
Case 2.2.2. Integers with $S(n)=15$ . That means $n=2007-15-6=1986$ which also does not work
Case 2.2.3. Integers with $S(n)=21$ . That means $n=2007-21-3=1983$ which is valid.
Case 2.2.4. Integers with $S(n)=24$ . That means $n=2007-24-6=1977$ which is also valid.
We have considered every case, so there are $\boxed{4}$ integers that satisfy the given condition.


Answer: 4.0

Solution:
It is well-known that $n \equiv S(n)\equiv S(S(n)) \pmod{9}.$ Substituting, we have that \[n+n+n \equiv 2007 \pmod{9} \implies n \equiv 0 \pmod{3}.\] Since $n \leq 2007,$ we must have that $\max S(n)=1+9+9+9=28.$ Now, we list out the possible vales for $S(n)$ in a table, noting that it is a multiple of $3$ because $n$ is a multiple of $3.$
Then, we compute the corresponding values of $S(S(n)).$
Finally, we may compute the corresponding values of $n$ using the fact that $n=2007-S(n)-S(S(n)).$
Notice how all conditions are designed to be satisfied except whether $S(n)$ is accurate with respect to $n.$ So, the only thing that remains is to check this. We may eliminate, for example, when $n=2007$ we have $S(n)=9$ while the table states that it is $0.$ Proceeding similarly, we obtain the following table.
It follows that there are $\boxed{4}$ possible values for $n.$ ~samrocksnature

Solution:
Let the number of digits of $n$ be $m$ . If $m = 5$ $n$ will already be greater than $2007$ . Notice that $S(n)$ is always at most $9m$ . Then if $m = 3$ $n$ will be at most $999$ $S(n)$ will be at most $27$ , and $S(S(n))$ will be even smaller than $27$ . Clearly we cannot reach a sum of $2007$ , unless $m = 4$ (i.e. $n$ has $4$ digits).
Then, let $n$ be a four digit number in the form $1000a + 100b + 10c + d$ . Then $S(n) = a + b + c + d$
$S(S(n))$ is the sum of the digits of $a + b + c + d$ . We can represent $S(S(n))$ as the sum of the tens digit and the ones digit of $S(n)$ . The tens digit in the form of a decimal is
$\frac{a + b + c + d}{10}$
To remove the decimal portion, we can simply take the floor of the expression,
$\lfloor\frac{a + b + c + d}{10}\rfloor$
Now that we have expressed the tens digit, we can express the ones digit as $S(n) -10$ times the above expression, or
$a + b + c + d - 10\lfloor\frac{a + b + c + d}{10}\rfloor$
Adding the two expressions yields the value of $S(S(n))$
$= a + b + c + d - 9\lfloor\frac{a + b + c + d}{10}\rfloor$
Combining this expression to the ones for $n$ and $S(n)$ yields
$1002a + 102b + 12c + 3d - 9\lfloor\frac{a + b + c + d}{10}\rfloor$
Setting this equal to $2007$ and rearranging a bit yields
$12c + 3d = 2007 - 1002a - 102b + 9\lfloor\frac{a + b + c + d}{10}\rfloor$
$\Rightarrow$ $4c + d = 669 - 334a - 34b + 3\lfloor\frac{a + b + c + d}{10}\rfloor$
(The reason for this slightly weird arrangement will soon become evident)
Now we examine the possible values of $a$ . If $a \ge 3$ $n$ is already too large. $a$ must also be greater than $0$ , or $n$ would be a $3$ -digit number. Therefore, $a = 1 \, \text{or} \, 2$ . Now we examine by case.
If $a = 2$ , then $b$ and $c$ must both be $0$ (otherwise $n$ would already be greater than $2007$ ). Substituting these values into the equation yields
$d = 1 + 3\lfloor\frac{2 + d}{10}\rfloor$
$\Rightarrow$ $d=1$
Sure enough, $2001 + (2+1) + 3=2007$
Now we move onto the case where $a = 1$ . Then our initial equation simplifies to
$4c + d = 335 - 34b + 3\lfloor\frac{1 + b + c + d}{10}\rfloor$
Since $c$ and $d$ can each be at most $9$ , we substitute that value to find the lower bound of $b$ . Doing so yields
$34b \ge 290 + 3\lfloor\frac{19 + b}{10}\rfloor$
The floor expression is at least $3\lfloor\frac{19}{10}\rfloor=3$ , so the right-hand side is at least $293$ . Solving for $b$ , we see that $b \ge 9$ $\Rightarrow$ $b=9$ . Again, we substitute for $b$ and the equation becomes
$4c + d = 29 + 3\lfloor\frac{10 + c + d}{10}\rfloor$
$\Rightarrow$ $4c + d = 32 + 3\lfloor\frac{c + d}{10}\rfloor$
Just like we did for $b$ , we can find the lower bound of $c$ by assuming $d = 9$ and solving:
$4c + 9 \ge 29 + 3\lfloor\frac{c + 9}{10}\rfloor$
$\Rightarrow$ $4c \ge 20 + 3\lfloor\frac{c + 9}{10}\rfloor$
The right hand side is $20$ for $c=0$ and $23$ for $c \ge 1$ . Solving for c yields $c \ge 6$ . Looking back at the previous equation, the floor expression is $0$ for $c+d \le 9$ and $3$ for $c+d \ge 10$ . Thus, the right-hand side is $32$ for $c+d \le 9$ and $35$ for $c+d \ge 10$ . We can solve these two scenarios as systems of equations/inequalities:
$4c+d = 32$
$c+d \le 9$
and
$4c+d=35$
$c+d \ge 10$
Solving yields three pairs $(c, d):$ $(8, 0)$ $(8, 3)$ ; and $(7, 7)$ . Checking the numbers $1980$ $1983$ , and $1977$ ; we find that all three work. Therefore there are a total of $4$ possibilities for $n$ $\Rightarrow$ $\boxed{4}$


Answer: 4.0

Solution:
Claim. The only positive integers $n$ that satisfy the condition are perfect multiples of $3$
Proof of claim:
We examine the positive integers mod $9$ . Here are the cases.
Case 1. $n \equiv 1 \pmod 9$ . Now, we examine $S(n)$ modulo $9$ .
Case 1.1. The tens digit of $n$ is different from the tens digit of the largest multiple of $9$ under $n$ . (In other words, this means we will carry when adding from the perfect multiple of $9$ under $n$ .)
Observe that when we carry, i.e. Add $1$ onto $1989$ to obtain $1990$ , the units digit decreases by $9$ while the tens digit increases by $1$ . This means that the sum of the digits decreases by $8$ in total, and we have $-8 \equiv 1 \pmod 9$ , so the "mod 9" of the sum increases by $1$ . This means that, regardless of whether the sum carries or not, the modulo 9 of the sum of the digits always increases by $1$
Case 1.2. The tens digits are the same, which is trivial since the units digit just increases by $1$ which means that the sum is also equivalent to $1 \pmod 9$
This means that $S(n) \equiv 1 \pmod 9$ and similarly letting the next $n=S(n)$ $S(S(n)) \equiv 1 \pmod 9$ . Summing these, we have $n+S(n)+S(S(n)) \equiv 3 \pmod 9$ . Clearly, no integers of this form will satisfy the condition because $2007$ is a perfect multiple of $9$
Case 2. $n \equiv 2 \pmod 9$
In this case, we apply exactly the same argument. There is at most one carry, which means that the sum of the digits will always be congruent to $2$ mod $9$ . Then we can apply similar arguments to get $S(n) \equiv 2 \pmod 9$ and $S(S(n)) \equiv 2 \pmod 9$ , so adding gives $n+S(n)+S(S(n)) \equiv 6 \pmod 9$
It is trivial to see that for $n \equiv k \pmod 9$ , for $0 \leq k \leq 8$ , we must have $n+S(n)+S(S(n)) \equiv 3k \pmod 9$ . Only when $k=0, 3, 6$ is $3k$ a multiple of $9$ , which means that $n$ must be a multiple of $3$
Now, we find the integers. Again, consider two cases: Integers that are direct multiples of $9$ and integers that are multiples of $3$ but not $9$
Case 1. $n$ is a multiple of $9$ . An integer of the form $\overline{20ab}$ will not work since the least such integer is $2007$ which already exceeds our bounds. Thus, we need only consider the integers of the form $\overline{19ab}$ . The valid sums of the digits of $n$ are $18$ and $27$ in this case.
Case 1.1. The sum of the digits is $18$ . This means that $S(n)=18, S(S(n))=9$ , so $n=2007-18-9=1980$ . Clearly this number satisfies our constraints.
Case 1.2. The sum of the digits is $27$ . This means that $S(n)=27, S(S(n))=9$ , ,so $n=2007-27-9=1971$ . Since the sum of the digits of $1971$ is not $27$ , this does not work.
This means that there is $1$ integer in this case.
Case 2. $n$ is a multiple of $3$ , not $9$ .
.
Case 2.1. Integers of the form $\overline{20ab}$ . Then $S(n)=3$ or $S(n)=6$ ; it is trivial to see that $S(n)=6$ exceeds our bounds, so $S(n)=3$ and $n=2007-6=2001$
Case 2.2. Integers of the form $\overline{19ab}$ . Then $S(n)=12, 15, 21, 24$ and we consider each case separately.
Case 2.2.1. Integers with $S(n)=12$ . That means $n=2007-12-3=1992$ which clearly does not work.
Case 2.2.2. Integers with $S(n)=15$ . That means $n=2007-15-6=1986$ which also does not work
Case 2.2.3. Integers with $S(n)=21$ . That means $n=2007-21-3=1983$ which is valid.
Case 2.2.4. Integers with $S(n)=24$ . That means $n=2007-24-6=1977$ which is also valid.
We have considered every case, so there are $\boxed{4}$ integers that satisfy the given condition.


Answer: 109.0

For each positive integer $n$ , let $f(n) = \sum_{k = 1}^{100} \lfloor \log_{10} (kn) \rfloor$ . Find the largest value of $n$ for which $f(n) \le 300$
Note: $\lfloor x \rfloor$ is the greatest integer less than or equal to $x$

Solution:
Observe that $f$ is strictly increasing in $n$ . We realize that we need $100$ terms to add up to around $300$ , so we need some sequence of $2$ s, $3$ s, and then $4$ s.
It follows that $n \approx 100$ (alternatively, use binary search to get to this, with $n\le 1000$ ). Manually checking shows that $f(109) = 300$ and $f(110) > 300$ . Thus, our answer is $\boxed{109}$

Solution: Because we want the value for which $f(n)=300$ , the average value of the 100 terms of the sequence should be around $3$ . For the value of $\lfloor \log_{10} (kn) \rfloor$ to be $3$ $1000 \le kn < 10000$ . We want kn to be around the middle of that range, and for k to be in the middle of 0 and 100, let $k=50$ , so $50n=\frac{10000+1000}{2}=\frac{11000}{2}=5500$ , and $n = 110$ $f(110) = 301$ , so we want to lower $n$ . Testing $109$ yields $300$ , so our answer is still $\boxed{109}$

Solution:
For any $n$ where the sum is close to $300$ , all the terms in the sum must be equal to $2$ $3$ or $4$ . Let $M$ be the number of terms less than or equal to $3$ and $N$ be the number of terms equal to $2$ (also counted in $M$ ). With this definition of $M$ and $N$ the total will be $400 - M - N \le 300$ , from which $M + N \ge 100$ . Now $M+1$ is the smallest integer $k$ for which $\log_{10}(kn) \ge 4$ or $kn \ge 10000$ , thus \[M = \left\lfloor\frac{9999}{n}\right\rfloor.\] Similarly, \[N = \left\lfloor\frac{999}{n}\right\rfloor = \left\lfloor\frac{M}{10}\right\rfloor.\]
Therefore, \[M + \left\lfloor \frac{M}{10} \right\rfloor \ge 100 \implies M \ge \left\lceil\frac{1000}{11}\right\rceil = 91 \implies n \le \left\lfloor\frac{9999}{91}\right\rfloor = 109.\] Since we want the largest possible $n$ , the answer is $\boxed{109}$

Solution:
Since we're working with base- $10$ logarithms, we can start by testing out $n$ 's that are powers of $10$ . For $n = 1$ , the terms in the sum are $\lfloor \log_{10} (1)\rfloor, \lfloor \log_{10} (2)\rfloor, \lfloor \log_{10} (3) \rfloor , . . . , \lfloor \log_{10} (100) \rfloor$ . For numbers $1$ $9$ $\lfloor \log_{10} (kn) \rfloor = 0$ . Then we have $90$ numbers, namely $10$ $99$ , for which $\lfloor \log_{10} (kn) \rfloor = 1$ . The last number we have is $100$ , which gives us $\lfloor \log_{10} (kn) \rfloor = 2$ . This sum gives us only $90 + 2 = 92$ , which is much too low. However, applying the same counting technique for $n = 10$ , our sum comes out to be $9 + 180 + 3 = 192$ , since there are $9$ terms for which $\lfloor \log_{10} (kn) \rfloor = 1$ $90$ terms for which $\lfloor \log_{10} (kn) \rfloor = 2$ , and one term for which $\lfloor \log_{10} (kn) \rfloor = 3$ . So we go up one more power of $10$ and get $18 + 270 + 4 = 292$ , which is very close to what we are looking for.
Now we only have to bump up the value of $n$ a bit and check our sum. Each increase in $n$ by $1$ actually increases the value of our sum by $1$ as well (except for $n = 101$ ), because whenever a $4$ is added to the sum, a $3$ is taken away. It doesn't take long to check and see that the value of $n$ we're looking for is $\boxed{109}$ , which corresponds to a sum of exactly $300$


Answer: 802.0

For each positive integer $n$ , let $f(n) = n^4 - 360n^2 + 400$ . What is the sum of all values of $f(n)$ that are prime numbers?
$\textbf{(A)}\ 794\qquad \textbf{(B)}\ 796\qquad \textbf{(C)}\ 798\qquad \textbf{(D)}\ 800\qquad \textbf{(E)}\ 802$

Solution: To find the answer it was enough to play around with $f$ . One can easily find that $f(1)=41$ is a prime, then $f$ becomes negative for $n$ between $2$ and $18$ , and then $f(19)=761$ is again a prime number. And as $41 + 761 = 802$ is already the largest option, the answer must be $\boxed{802}$

Solution:
We will now show a complete solution, with a proof that no other values are prime.
Consider the function $g(x) = x^2 - 360x + 400$ , then obviously $f(x) = g(x^2)$
The roots of $g$ are: \[x_{1,2}  = \frac{ 360 \pm \sqrt{ 360^2 - 4\cdot 400 } }2  = 180 \pm 80 \sqrt 5\]
We can then write $g(x) = (x - 180 - 80\sqrt 5)(x - 180 + 80\sqrt 5)$ , and thus $f(x) = (x^2 - 180 - 80\sqrt 5)(x^2 - 180 + 80\sqrt 5)$
We would now like to factor the right hand side further, using the formula $(x^2 - y^2) = (x-y)(x+y)$ . To do this, we need to express both constants as squares of some other constants. Luckily, we have a pretty good idea how they look like.
We are looking for rational $a$ and $b$ such that $(a+b\sqrt 5)^2 = 180 + 80\sqrt 5$ . Expanding the left hand side and comparing coefficients, we get $ab=40$ and $a^2 + 5b^2 = 180$ . We can easily guess (or compute) the solution $a=10$ $b=4$
Hence $180 + 80\sqrt 5 = (10 + 4\sqrt 5)^2$ , and we can easily verify that also $180 - 80\sqrt 5 = (10 - 4\sqrt 5)^2$
We now know the complete factorization of $f(x)$
\[f(x) = (x - 10 - 4\sqrt 5)(x + 10 + 4\sqrt 5)(x - 10 + 4\sqrt 5)(x + 10 - 4\sqrt 5)\]
As the final step, we can now combine the factors in a different way, in order to get rid of the square roots.
We have $(x - 10 - 4\sqrt 5)(x - 10 + 4\sqrt 5) = (x-10)^2 - (4\sqrt 5)^2 = x^2 - 20x + 20$ ,
and $(x + 10 - 4\sqrt 5)(x + 10 + 4\sqrt 5) = x^2 + 20x + 20$
Hence we obtain the factorization $f(x) = (x^2 - 20x + 20)(x^2 + 20x + 20)$
For $x\geq 20$ both terms are positive and larger than one, hence $f(x)$ is not prime. For $1<x<19$ the second factor is positive and the first one is negative, hence $f(x)$ is not a prime. The remaining cases are $x=1$ and $x=19$ . In both cases, $f(x)$ is indeed a prime, and their sum is $f(1) + f(19) = 41 + 761 = \boxed{802}$


Answer: 10.0

For each positive integer $n$ , let $f_1(n)$ be twice the number of positive integer divisors of $n$ , and for $j \ge 2$ , let $f_j(n) = f_1(f_{j-1}(n))$ . For how many values of $n \le 50$ is $f_{50}(n) = 12?$
$\textbf{(A) }7\qquad\textbf{(B) }8\qquad\textbf{(C) }9\qquad\textbf{(D) }10\qquad\textbf{(E) }11$

Solution:
First, we can test values that would make $f(x)=12$ true. For this to happen $x$ must have $6$ divisors, which means its prime factorization is in the form $pq^2$ or $p^5$ , where $p$ and $q$ are prime numbers. Listing out values less than $50$ which have these prime factorizations, we find $12,18,20,28,44,45,50$ for $pq^2$ , and just $32$ for $p^5$ . Here $12$ especially catches our eyes, as this means if one of $f_i(n)=12$ , each of $f_{i+1}(n), f_{i+2}(n), ...$ will all be $12$ . This is because $f_{i+1}(n)=f(f_i(n))$ (as given in the problem statement), so were $f_i(n)=12$ , plugging this in we get $f_{i+1}(n)=f(12)=12$ , and thus the pattern repeats. Hence, as long as for a $i$ , such that $i\leq 50$ and $f_{i}(n)=12$ $f_{50}(n)=12$ must be true, which also immediately makes all our previously listed numbers, where $f(x)=12$ , possible values of $n$
We also know that if $f(x)$ were to be any of these numbers, $x$ would satisfy $f_{50}(n)$ as well. Looking through each of the possibilities aside from $12$ , we see that $f(x)$ could only possibly be equal to $20$ and $18$ , and still have $x$ less than or equal to $50$ . This would mean $x$ must have $10$ , or $9$ divisors, and testing out, we see that $x$ will then be of the form $p^4q$ , or $p^2q^2$ . The only two values less than or equal to $50$ would be $48$ and $36$ respectively. From here there are no more possible values, so tallying our possibilities we count $\boxed{10}$ values (Namely $12,18,20,28,32,36,44,45,48,50$ ).

Solution:
First, take note that the maximum possible value of $f_1(n)$ for $1 \le n \le k$ increases as $k$ increases (it is a step function), i.e. it is increasing. Likewise, as $k$ decreases, the maximum possible value of $f_1(n)$ decreases as well. Also, let $f_1(n) = 2d(n)$ where $d(n)$ is the number of divisors of n.
Since $n \le 50$ $f_1(n) <= 20$ . This maximum occurs when $d(n) = 10 \implies n = 2^4 \cdot 3 = 48$ . Next, since $f_1(n) <=20$ $f_1(f_1(n)) \le 12 \implies f_2(n) \le 12$ . This maximum occurs when $d(f_1(n)) = 6 \implies n = 2 \cdot 3^2 = 18, n = 2^2 \cdot 3 = 12$ . Since $f_2(n) \le 12$ $f_1(f_2(n)) \le 12 \implies f_3(n) \le 12$ , once again. This maximum again occurs when $d(f_2(n)) = 6 \implies f_2(n) = 2^2 \cdot 3 = 12$ . Now, suppose for the sake of contradiction that $f_2(n) < 12$ . Then, $f_3(n) < 12$ (since $f_2(n) = 12$ was the only number that would maximize $f_3(n))$ for $f_2(n) \le 12$ ). As a result, since $f_1(n)$ is increasing, and because $12$ is where $f_1$ steps down from a maximum of $6 \cdot 2 = 12$ , we must have that $f_1(f_3(n)) < f_1(12) = 12 \implies f_4(n) < 12$ . We continue applying $f_1$ on both sides (which is possible since $f_1$ is increasing) until we reach $f_50$ , giving us that $f_50(n) < 12$ . However, $f_50(n) = 12$ , which is a contradiction. Thus, $f_2(n) = 12$
Now, let us finally solve for the solutions. $f_2(n) = 12 \implies f_1(f_1(n)) = 12 \implies d(f_1(n)) = 6$ $d(f_1(n)) = 6 \implies f_1(n) = p^2 \cdot q$ where $p$ and $q$ are primes. Since $f_1(n) \le 20$ $f_1(n)$ can only be $12$ $18$ , or $20$ . If $f_1(n) = 12$ , then $d(n) = 6 \implies n = p^5, p^2 \cdot q \implies n \in \{ 12, 18, 20, 28, 32, 44, 45, 50 \}$ , resulting in 8 solutions. If $f_1(n) = 18$ , then $d(n) = 9 \implies n = p^8, p^2 \cdot q^2 \implies n = 36$ , giving us one more solution. Finally, $f_1(n) = 20 \implies d(n) = 10 \implies n = p^9, p^4 \cdot q \implies n = 48$ . Thus, in total, we have $\boxed{10}$ solutions.

Solution:
$\textbf{Observation 1}$ $f_1 \left( 12 \right) = 12$
Hence, if $n$ has the property that $f_j \left( n \right) = 12$ for some $j$ , then $f_k \left( n \right) = 12$ for all $k > j$
$\textbf{Observation 2}$ $f_1 \left( 8 \right) = 8$
Hence, if $n$ has the property that $f_j \left( n \right) = 8$ for some $j$ , then $f_k \left( n \right) = 8$ for all $k > j$
$\textbf{Case 1}$ $n = 1$
We have $f_1 \left( n \right) = 2$ $f_2 \left( n \right) = f_1 \left( 2 \right) = 4$ $f_3 \left( n \right) = f_1 \left( 4 \right) = 6$ $f_4 \left( n \right) = f_1 \left( 6 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 2}$ $n$ is prime.
We have $f_1 \left( n \right) = 4$ $f_2 \left( n \right) = f_1 \left( 4 \right) = 6$ $f_3 \left( n \right) = f_1 \left( 6 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 3}$ : The prime factorization of $n$ takes the form $p_1^2$
We have $f_1 \left( n \right) = 6$ $f_2 \left( n \right) = f_1 \left( 6 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 4}$ : The prime factorization of $n$ takes the form $p_1^3$
We have $f_1 \left( n \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 5}$ : The prime factorization of $n$ takes the form $p_1^4$
We have $f_1 \left( n \right) = 10$ $f_2 \left( n \right) = f_1 \left( 10 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 6}$ : The prime factorization of $n$ takes the form $p_1^5$
We have $f_1 \left( n \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case the only $n$ is $2^5 = 32$
$\textbf{Case 7}$ : The prime factorization of $n$ takes the form $p_1 p_2$
We have $f_1 \left( n \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 8}$ : The prime factorization of $n$ takes the form $p_1 p_2^2$
We have $f_1 \left( n \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case, all $n$ are $12, 18, 20, 28, 44, 45,$ and $50$
$\textbf{Case 9}$ : The prime factorization of $n$ takes the form $p_1 p_2^3$
We have $f_1 \left( n \right) = 16$ $f_2 \left( n \right) = f_1 \left( 16 \right) = 10$ $f_3 \left( n \right) = f_1 \left( 10 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 10}$ : The prime factorization of $n$ takes the form $p_1 p_2^4$
We have $f_1 \left( n \right) = 20$ $f_2 \left( n \right) = f_1 \left( 20 \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case, the only $n$ is $48$
$\textbf{Case 11}$ : The prime factorization of $n$ takes the form $p_1^2 p_2^2$
We have $f_1 \left( n \right) = 18$ $f_2 \left( n \right) = f_1 \left( 18 \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case, the only $n$ is $36$
$\textbf{Case 12}$ : The prime factorization of $n$ takes the form $p_1 p_2 p_3$
We have $f_1 \left( n \right) = 16$ $f_2 \left( n \right) = f_1 \left( 16 \right) = 10$ $f_3 \left( n \right) = f_2 \left( 10 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
Putting all cases together, the number of feasible $n \leq 50$ is $\boxed{10}$


Answer: 10.0

Solution:
First, we can test values that would make $f(x)=12$ true. For this to happen $x$ must have $6$ divisors, which means its prime factorization is in the form $pq^2$ or $p^5$ , where $p$ and $q$ are prime numbers. Listing out values less than $50$ which have these prime factorizations, we find $12,18,20,28,44,45,50$ for $pq^2$ , and just $32$ for $p^5$ . Here $12$ especially catches our eyes, as this means if one of $f_i(n)=12$ , each of $f_{i+1}(n), f_{i+2}(n), ...$ will all be $12$ . This is because $f_{i+1}(n)=f(f_i(n))$ (as given in the problem statement), so were $f_i(n)=12$ , plugging this in we get $f_{i+1}(n)=f(12)=12$ , and thus the pattern repeats. Hence, as long as for a $i$ , such that $i\leq 50$ and $f_{i}(n)=12$ $f_{50}(n)=12$ must be true, which also immediately makes all our previously listed numbers, where $f(x)=12$ , possible values of $n$
We also know that if $f(x)$ were to be any of these numbers, $x$ would satisfy $f_{50}(n)$ as well. Looking through each of the possibilities aside from $12$ , we see that $f(x)$ could only possibly be equal to $20$ and $18$ , and still have $x$ less than or equal to $50$ . This would mean $x$ must have $10$ , or $9$ divisors, and testing out, we see that $x$ will then be of the form $p^4q$ , or $p^2q^2$ . The only two values less than or equal to $50$ would be $48$ and $36$ respectively. From here there are no more possible values, so tallying our possibilities we count $\boxed{10}$ values (Namely $12,18,20,28,32,36,44,45,48,50$ ).

Solution:
First, take note that the maximum possible value of $f_1(n)$ for $1 \le n \le k$ increases as $k$ increases (it is a step function), i.e. it is increasing. Likewise, as $k$ decreases, the maximum possible value of $f_1(n)$ decreases as well. Also, let $f_1(n) = 2d(n)$ where $d(n)$ is the number of divisors of n.
Since $n \le 50$ $f_1(n) <= 20$ . This maximum occurs when $d(n) = 10 \implies n = 2^4 \cdot 3 = 48$ . Next, since $f_1(n) <=20$ $f_1(f_1(n)) \le 12 \implies f_2(n) \le 12$ . This maximum occurs when $d(f_1(n)) = 6 \implies n = 2 \cdot 3^2 = 18, n = 2^2 \cdot 3 = 12$ . Since $f_2(n) \le 12$ $f_1(f_2(n)) \le 12 \implies f_3(n) \le 12$ , once again. This maximum again occurs when $d(f_2(n)) = 6 \implies f_2(n) = 2^2 \cdot 3 = 12$ . Now, suppose for the sake of contradiction that $f_2(n) < 12$ . Then, $f_3(n) < 12$ (since $f_2(n) = 12$ was the only number that would maximize $f_3(n))$ for $f_2(n) \le 12$ ). As a result, since $f_1(n)$ is increasing, and because $12$ is where $f_1$ steps down from a maximum of $6 \cdot 2 = 12$ , we must have that $f_1(f_3(n)) < f_1(12) = 12 \implies f_4(n) < 12$ . We continue applying $f_1$ on both sides (which is possible since $f_1$ is increasing) until we reach $f_50$ , giving us that $f_50(n) < 12$ . However, $f_50(n) = 12$ , which is a contradiction. Thus, $f_2(n) = 12$
Now, let us finally solve for the solutions. $f_2(n) = 12 \implies f_1(f_1(n)) = 12 \implies d(f_1(n)) = 6$ $d(f_1(n)) = 6 \implies f_1(n) = p^2 \cdot q$ where $p$ and $q$ are primes. Since $f_1(n) \le 20$ $f_1(n)$ can only be $12$ $18$ , or $20$ . If $f_1(n) = 12$ , then $d(n) = 6 \implies n = p^5, p^2 \cdot q \implies n \in \{ 12, 18, 20, 28, 32, 44, 45, 50 \}$ , resulting in 8 solutions. If $f_1(n) = 18$ , then $d(n) = 9 \implies n = p^8, p^2 \cdot q^2 \implies n = 36$ , giving us one more solution. Finally, $f_1(n) = 20 \implies d(n) = 10 \implies n = p^9, p^4 \cdot q \implies n = 48$ . Thus, in total, we have $\boxed{10}$ solutions.

Solution:
$\textbf{Observation 1}$ $f_1 \left( 12 \right) = 12$
Hence, if $n$ has the property that $f_j \left( n \right) = 12$ for some $j$ , then $f_k \left( n \right) = 12$ for all $k > j$
$\textbf{Observation 2}$ $f_1 \left( 8 \right) = 8$
Hence, if $n$ has the property that $f_j \left( n \right) = 8$ for some $j$ , then $f_k \left( n \right) = 8$ for all $k > j$
$\textbf{Case 1}$ $n = 1$
We have $f_1 \left( n \right) = 2$ $f_2 \left( n \right) = f_1 \left( 2 \right) = 4$ $f_3 \left( n \right) = f_1 \left( 4 \right) = 6$ $f_4 \left( n \right) = f_1 \left( 6 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 2}$ $n$ is prime.
We have $f_1 \left( n \right) = 4$ $f_2 \left( n \right) = f_1 \left( 4 \right) = 6$ $f_3 \left( n \right) = f_1 \left( 6 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 3}$ : The prime factorization of $n$ takes the form $p_1^2$
We have $f_1 \left( n \right) = 6$ $f_2 \left( n \right) = f_1 \left( 6 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 4}$ : The prime factorization of $n$ takes the form $p_1^3$
We have $f_1 \left( n \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 5}$ : The prime factorization of $n$ takes the form $p_1^4$
We have $f_1 \left( n \right) = 10$ $f_2 \left( n \right) = f_1 \left( 10 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 6}$ : The prime factorization of $n$ takes the form $p_1^5$
We have $f_1 \left( n \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case the only $n$ is $2^5 = 32$
$\textbf{Case 7}$ : The prime factorization of $n$ takes the form $p_1 p_2$
We have $f_1 \left( n \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 8}$ : The prime factorization of $n$ takes the form $p_1 p_2^2$
We have $f_1 \left( n \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case, all $n$ are $12, 18, 20, 28, 44, 45,$ and $50$
$\textbf{Case 9}$ : The prime factorization of $n$ takes the form $p_1 p_2^3$
We have $f_1 \left( n \right) = 16$ $f_2 \left( n \right) = f_1 \left( 16 \right) = 10$ $f_3 \left( n \right) = f_1 \left( 10 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
$\textbf{Case 10}$ : The prime factorization of $n$ takes the form $p_1 p_2^4$
We have $f_1 \left( n \right) = 20$ $f_2 \left( n \right) = f_1 \left( 20 \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case, the only $n$ is $48$
$\textbf{Case 11}$ : The prime factorization of $n$ takes the form $p_1^2 p_2^2$
We have $f_1 \left( n \right) = 18$ $f_2 \left( n \right) = f_1 \left( 18 \right) = 12$ . Hence, Observation 1 implies $f_{50} \left( n \right) = 12$
In this case, the only $n$ is $36$
$\textbf{Case 12}$ : The prime factorization of $n$ takes the form $p_1 p_2 p_3$
We have $f_1 \left( n \right) = 16$ $f_2 \left( n \right) = f_1 \left( 16 \right) = 10$ $f_3 \left( n \right) = f_2 \left( 10 \right) = 8$ . Hence, Observation 2 implies $f_{50} \left( n \right) = 8$
Putting all cases together, the number of feasible $n \leq 50$ is $\boxed{10}$


Answer: 4015.0

For each positive integer $n$ , the mean of the first $n$ terms of a sequence is $n$ . What is the $2008$ th term of the sequence?
$\textbf{(A)}\ 2008 \qquad \textbf{(B)}\ 4015 \qquad \textbf{(C)}\ 4016 \qquad \textbf{(D)}\ 4030056 \qquad \textbf{(E)}\ 4032064$

Solution:
Letting the sum of the sequence equal $a_1+a_2+\cdots+a_n$ yields the following two equations:
$\frac{a_1+a_2+\cdots+a_{2008}}{2008}=2008$ and
$\frac{a_1+a_2+\cdots+a_{2007}}{2007}=2007$
Therefore:
$a_1+a_2+\cdots+a_{2008}=2008^2$ and $a_1+a_2+\cdots+a_{2007}=2007^2$
Hence, by substitution, $a_{2008}=2008^2-2007^2=(2008+2007)(2008-2007)=4015(1)=4015\implies\boxed{4015}$


Answer: 4015.0

For each positive integer $n$ , the mean of the first $n$ terms of a sequence is $n$ . What is the $2008^{\text{th}}$ term of the sequence?
$\mathrm{(A)}\ {{{2008}}} \qquad \mathrm{(B)}\ {{{4015}}} \qquad \mathrm{(C)}\ {{{4016}}} \qquad \mathrm{(D)}\ {{{4,030,056}}} \qquad \mathrm{(E)}\ {{{4,032,064}}}$

Solution: Since the mean of the first $n$ terms is $n$ , the sum of the first $n$ terms is $n^2$ . Thus, the sum of the first $2007$ terms is $2007^2$ and the sum of the first $2008$ terms is $2008^2$ . Hence, the $2008^{\text{th}}$ term of the sequence is $2008^2-2007^2=(2008+2007)(2008-2007)=4015\Rightarrow \boxed{4015}$

Solution: Let $a_1, a_2, a_3, \cdots, a_n$ be the terms of the sequence. We know $\frac{a_1 + a_2 + a_3 + \cdots + a_n}{n} = n$ , so we must have $a_1 + a_2 + a_3 + \cdots + a_n = n^2$ . The sum of consecutive odd numbers down to $1$ is a perfect square, if you don't believe me, try drawing squares with the sum, so $a_1 = 1, a_2 = 3, a_3 = 5, \cdots , a_n = 2(n-1) + 1$ , so the answer is $a_{2008} = 2(2007) + 1 = \boxed{4015}$

Solution:
Let the mean be $\frac{(a)+(a+d)+(a+2d)+...+(a+(n-1)) \cdot d)}{n}$ $=\frac{n \cdot a}{n} + \frac{(1+2+3+...+(n-1)) \cdot d}{n}$ $=a + \frac{n \cdot (n-1) \cdot d}{2n}$ $=a+ \frac{(n-1) \cdot d}{2}$
Note that this is also equal to n
$a+ \frac{(n-1) \cdot d}{2}=n$ $\therefore 2a+ (n-1) \cdot d=2n$
1st term + nth term $=2n=2 \cdot 2008=4016$ Now note that, from previous solutions, the first term is 1, hence the 2008th term is $4016-1=\boxed{4015}$

Solution: From inspection, we see that the sum of the sequence is $n^2$ . We also notice that $n^2$ is the sum of the first $n$ odd integers. Because $4015$ is the only odd integer, $\boxed{4015}$ is the answer.


Answer: 363.0

For each positive integer $n$ let $a_n$ be the least positive integer multiple of $23$ such that $a_n \equiv 1 \pmod{2^n}.$ Find the number of positive integers $n$ less than or equal to $1000$ that satisfy $a_n = a_{n+1}.$

Solution:
Denote $a_n = 23 b_n$ .
Thus, for each $n$ , we need to find smallest positive integer $k_n$ , such that \[ 23 b_n = 2^n k_n + 1 . \]
Thus, we need to find smallest $k_n$ , such that \[ 2^n k_n \equiv - 1 \pmod{23} . \]
Now, we find the smallest $m$ , such that $2^m \equiv 1 \pmod{23}$ .
By Fermat's Theorem, we must have $m | \phi \left( 23 \right)$ . That is, $m | 22$ .
We find $m = 11$
Therefore, for each $n$ , we need to find smallest $k_n$ , such that \[ 2^{{\rm Rem} \left( n , 11 \right)} k_n \equiv - 1 \pmod{23} . \]
We have the following results:
If \({\rm Rem} \left( n , 11 \right) = 0\), then \(k_n = 22\) and \(b_n = 1\).
If \({\rm Rem} \left( n , 11 \right) = 1\), then \(k_n = 11\) and \(b_n = 1\).
If \({\rm Rem} \left( n , 11 \right) = 2\), then \(k_n = 17\) and \(b_n = 3\).
If \({\rm Rem} \left( n , 11 \right) = 3\), then \(k_n = 20\) and \(b_n = 7\).
If \({\rm Rem} \left( n , 11 \right) = 4\), then \(k_n = 10\) and \(b_n = 7\).
If \({\rm Rem} \left( n , 11 \right) = 5\), then \(k_n = 5\) and \(b_n = 7\).
If \({\rm Rem} \left( n , 11 \right) = 6\), then \(k_n = 14\) and \(b_n = 39\).
If \({\rm Rem} \left( n , 11 \right) = 7\), then \(k_n = 7\) and \(b_n = 39\).
If \({\rm Rem} \left( n , 11 \right) = 8\), then \(k_n = 15\) and \(b_n = 167\).
If \({\rm Rem} \left( n , 11 \right) = 9\), then \(k_n = 19\) and \(b_n = 423\).
If \({\rm Rem} \left( n , 11 \right) = 10\), then \(k_n = 21\) and \(b_n = 935\).
Therefore, in each cycle, $n \in \left\{ 11 l , 11l + 1 , \cdots , 11l + 10 \right\}$ , we have $n = 11l$ $11l + 3$ $11l + 4$ $11l + 6$ , such that $b_n = b_{n+1}$ . That is, $a_n = a_{n+1}$ .
At the boundary of two consecutive cycles, $b_{11L + 10} \neq b_{11 \left(l + 1 \right)}$
We have $1000 = 90 \cdot 11 + 10$ .
Therefore, the number of feasible $n$ is $91 \cdot 4 - 1 = \boxed{363}$


Answer: 955.0

For each positive integer $p$ , let $b(p)$ denote the unique positive integer $k$ such that $|k-\sqrt{p}| < \frac{1}{2}$ .  For example, $b(6) = 2$ and $b(23) = 5$ .  If $S = \sum_{p=1}^{2007} b(p),$ find the remainder when $S$ is divided by 1000.

Solution:
$\left(k- \frac 12\right)^2=k^2-k+\frac 14$ and $\left(k+ \frac 12\right)^2=k^2+k+ \frac 14$ . Therefore $b(p)=k$ if and only if $p$ is in this range, or $k^2-k<p\leq k^2+k$ . There are $2k$ numbers in this range, so the sum of $b(p)$ over this range is $(2k)k=2k^2$ $44<\sqrt{2007}<45$ , so all numbers $1$ to $44$ have their full range. Summing this up with the formula for the sum of the first $n$ squares ( $\frac{n(n+1)(2n+1)}{6}$ ), we get $\sum_{k=1}^{44}2k^2=2\frac{44(44+1)(2*44+1)}{6}=58740$ . We need only consider the $740$ because we are working with modulo $1000$
Now consider the range of numbers such that $b(p)=45$ . These numbers are $\left\lceil\frac{44^2 + 45^2}{2}\right\rceil = 1981$ to $2007$ . There are $2007 - 1981 + 1 = 27$ (1 to be inclusive) of them. $27*45=1215$ , and $215+740= \boxed{955}$ , the answer.

Solution: Let $p$ be in the range of $a^2 \le p < (a+1)^2$ . Then, we need to find the point where the value of $b(p)$ flips from $k$ to $k+1$ . This will happen when $p$ exceeds $(a+\frac{1}{2})^2$ or $a(a+1)+\frac{1}{4}$ . Thus, if $a^2 \le p \le a(a+1)$ then $b(p)=a$ . For $a(a+1) < p < (a+1)^2$ , then $b(p)=a+1$ . There are $a+1$ terms in the first set of $p$ , and $a$ terms in the second set. Thus, the sum of $b(p)$ from $a^2 \le p <(a+1)^2$ is $2a(a+1)$ or $4\cdot\binom{a+1}{2}$ . For the time being, consider that $S = \sum_{p=1}^{44^2-1} b(p)$ . Then, the sum of the values of $b(p)$ is $4\binom{2}{2}+4\binom{3}{2}+\cdots +4\binom{44}{2}=4\left(\binom{2}{2}+\binom{3}{2}+\cdots +\binom{44}{2}\right)$ . We can collapse this to $4\binom{45}{3}=56760$ . Now, we have to consider $p$ from $44^2 \le p < 2007$ . Considering $p$ from just $44^2 \le p \le 1980$ , we see that all of these values have $b(p)=44$ . Because there are $45$ values of $p$ in that range, the sum of $b(p)$ in that range is $45\cdot44=1980$ . Adding this to $56760$ we get $58740$ or $740$ mod $1000$ . Now, take the range $1980 < p \le 2007$ . There are $27$ values of $p$ in this range, and each has $b(p)=45$ . Thus, that contributes $27*45=1215$ or $215$ to the sum. Finally, adding $740$ and $215$ we get $740+215=\boxed{955}$


Answer: 6.0

For each positive number $x$ , let $f(x)=\frac{\left(x+\frac{1}{x}\right)^6-\left(x^6+\frac{1}{x^6}\right)-2} {\left(x+\frac{1}{x}\right)^3+\left(x^3+\frac{1}{x^3}\right)}$ .
The minimum value of $f(x)$ is
$\textbf{(A) }1\qquad \textbf{(B) }2\qquad \textbf{(C) }3\qquad \textbf{(D) }4\qquad \textbf{(E) }6$

Solution:
Let $a = \left( x + \frac{1}{x} \right)^3$ and $b = x^3 + \frac{1}{x^3}$ . Then \begin{align*} f(x) &= \frac{\left( x + \frac{1}{x} \right)^6 - (x^6 + \frac{1}{x^6}) - 2}{\left( x + \frac{1}{x} \right)^3 + (x^3 + \frac{1}{x^3})} \\ &= \frac{\left( x + \frac{1}{x} \right)^6 - (x^6 + 2 + \frac{1}{x^6})}{\left( x + \frac{1}{x} \right)^3 + (x^3 + \frac{1}{x^3})} \\ &= \frac{\left( x + \frac{1}{x} \right)^6 - (x^3 + \frac{1}{x^3})^2}{\left( x + \frac{1}{x} \right)^3 + (x^3 + \frac{1}{x^3})} \\ &= \frac{a^2 - b^2}{a + b}. \end{align*}
By difference of squares, \begin{align*} f(x) &= \frac{(a - b)(a + b)}{a + b} \\ &= a - b \\ &= \left( x + \frac{1}{x} \right)^3 - \left( x^3 + \frac{1}{x^3} \right) \\ &= \left( x^3 + 3x + \frac{3}{x} + \frac{1}{x^3} \right) - \left( x^3 + \frac{1}{x^3} \right) \\ &= 3x + \frac{3}{x} \\ &= 3 \left( x + \frac{1}{x} \right). \end{align*}
By the AM-GM inequality, \[x + \frac{1}{x} \ge 2,\] so $f(x) \ge 6$ . Furthermore, when $x = 1$ $f(1) = 6$ , so the minimum value of $f(x)$ is $\boxed{6}$


Answer: 340.0

For each real number $x$ , let $\lfloor x \rfloor$ denote the greatest integer that does not exceed x. For how many positive integers $n$ is it true that $n<1000$ and that $\lfloor \log_{2} n \rfloor$ is a positive even integer?

Solution:
For integers $k$ , we want $\lfloor \log_2 n\rfloor = 2k$ , or $2k \le \log_2 n < 2k+1 \Longrightarrow 2^{2k} \le n < 2^{2k+1}$ . Thus, $n$ must satisfy these inequalities (since $n < 1000$ ):
There are $4$ for the first inequality, $16$ for the second, $64$ for the third, and $256$ for the fourth, so the answer is $4+16+64+256=\boxed{340}$


Answer: 8.0

For every $3^\circ$ rise in temperature, the volume of a certain gas expands by $4$ cubic centimeters.  If the volume of the gas is $24$ cubic centimeters when the temperature is $32^\circ$ , what was the volume of the gas in cubic centimeters when the temperature was $20^\circ$
$\text{(A)}\ 8 \qquad \text{(B)}\ 12 \qquad \text{(C)}\ 15 \qquad \text{(D)}\ 16 \qquad \text{(E)}\ 40$

Solution: We know that \[T=32-3k\Rightarrow V=24-4k.\] Setting $k=4$ , we get the volume when the temperature is $20^\circ$ , which is $24-4(4)=8\rightarrow \boxed{8}$


Answer: 59.0

For every $m \geq 2$ , let $Q(m)$ be the least positive integer with the following property: For every $n \geq Q(m)$ , there is always a perfect cube $k^3$ in the range $n < k^3 \leq m \cdot n$ . Find the remainder when \[\sum_{m = 2}^{2017} Q(m)\] is divided by 1000.

Solution:
We claim that $Q(m) = 1$ when $m \ge 8$
When $m \ge 8$ , for every $n \ge Q(m) = 1$ , we need to prove there exists an integer $k$ , such that $n < k^3 \le m \cdot n$
Thats because $\sqrt[3]{m \cdot n} - \sqrt[3]{n} \ge 2\sqrt[3]{n} - \sqrt[3]{n} = \sqrt[3]{n} \ge 1$ , so k exists between $\sqrt[3]{m \cdot n}$ and $\sqrt[3]{n}$
$\sqrt[3]{n} < k \le \sqrt[3]{m \cdot n}$
We can then hand evaluate $Q(m)$ for $m = 2,3,4,5,6,7$ , and get $Q(2) = 32$ $Q(3) = 9$ , and all the others equal 2.
There are a total of 2010 integers from 8 to 2017.
\[\sum_{m = 2}^{2017} Q(m) \equiv \sum_{m = 2}^{7} Q(m) + 2010 \equiv 32+9+2+2+2+2+10 = \boxed{059} \mod 1000\]


Answer: 3.0

For every composite positive integer $n$ , define $r(n)$ to be the sum of the factors in the prime factorization of $n$ . For example, $r(50) = 12$ because the prime factorization of $50$ is $2 \times 5^{2}$ , and $2 + 5 + 5 = 12$ . What is the range of the function $r$ $\{r(n): n \text{ is a composite positive integer}\}$
$\textbf{(A)}\; \text{the set of positive integers} \\ \textbf{(B)}\; \text{the set of composite positive integers} \\ \textbf{(C)}\; \text{the set of even positive integers} \\ \textbf{(D)}\; \text{the set of integers greater than 3} \\ \textbf{(E)}\; \text{the set of integers greater than 4}$

Solution: This problem becomes simple once we recognize that the domain of the function is $\{4, 6, 8, 9, 10, 12, 14, 15, \dots\}$ . By evaluating $r(4)$ to be $4$ , we can see that $\textbf{(E)}$ is incorrect. Evaluating $r(6)$ to be $5$ , we see that both $\textbf{(B)}$ and $\textbf{(C)}$ are incorrect. Since our domain consists of composite numbers, which, by definition, are a product of at least two positive primes, the minimum value of $r(n)$ is $4$ , so $\textbf{(A)}$ is incorrect. That leaves us with $\boxed{3}$

Solution:
Think backwards. The range is the same as the numbers $y$ that can be expressed as the sum of two or more prime positive integers.
The lowest number we can get is $y = 2+2 = 4$ . For any number greater than 4, we can get to it by adding some amount of 2's and then possibly a 3 if that number is odd. For example, 23 can be obtained by adding 2 ten times and adding a 3; this corresponds to the argument $n = 2^{10} \times 3$ .  Thus our answer is $\boxed{3}$


Answer: 87.5

For every dollar Ben spent on bagels, David spent $25$ cents less. Ben paid $$12.50$ more than David. How much did they spend in the bagel store together?
$\textbf{(A)}\ $37.50 \qquad\textbf{(B)}\ $50.00\qquad\textbf{(C)}\ $87.50\qquad\textbf{(D)}\ $90.00\qquad\textbf{(E)}\ $92.50$

Solution: If Ben paid $$ 12.50$ more than David, then he paid $\frac{12.5}{.25}= $ 50.00$ . Thus, David paid $$ 37.50$ , and they spent $50.00+37.50 =$ 87.50 \implies \boxed{87.50}$


Answer: 77.0

For every integer $n\ge2$ , let $\text{pow}(n)$ be the largest power of the largest prime that divides $n$ . For example $\text{pow}(144)=\text{pow}(2^4\cdot3^2)=3^2$ . What is the largest integer $m$ such that $2010^m$ divides
$\textbf{(A)}\ 74 \qquad \textbf{(B)}\ 75 \qquad \textbf{(C)}\ 76 \qquad \textbf{(D)}\ 77 \qquad \textbf{(E)}\ 78$

Solution:
Because 67 is the largest prime factor of 2010, it means that in the prime factorization of $\prod_{n=2}^{5300}\text{pow}(n)$ , there'll be $p_1 ^{e_1} \cdot p_2 ^{e_2} \cdot .... 67^x ...$ where $x$ is the desired value we are looking for. Thus, to find this answer, we need to look for the number of times $67$ is incorporated into the giant product.
All numbers $n=67 \cdot x$ , given $x = p_1 ^ {e_1} \cdot p_2 ^{e_2} \cdot ... \cdot p_m ^ {e_m}$ such that for any integer $x$ between $1$ and $m$ , prime $p_x$ must be less than $67$ , contributes a 67 to the product. Considering $67 \cdot 79 < 5300 < 67 \cdot 80$ , the possible values of x are $1,2,...,70,72,74,...78$ , since $x=71,73,79$ are primes that are greater than 67. However, $\text{pow}\left(67^2\right)$ contributes two $67$ s to the product, so we must count it twice. Therefore, the answer is $70 + 1 + 6 = \boxed{77}$

Solution: After finding the prime factorization of $2010=2\cdot3\cdot5\cdot67$ , divide $5300$ by $67$ and add $5300$ divided by $67^2$ in order to find the total number of multiples of $67$ between $2$ and $5300$ $\lfloor\frac{5300}{67}\rfloor+\lfloor\frac{5300}{67^2}\rfloor=80$ Since $71$ $73$ , and $79$ are prime numbers greater than $67$ and less than or equal to $80$ , subtract $3$ from $80$ to get the answer $80-3=\boxed{77}$


Answer: 1.0

For every positive integer $n$ , let $\text{mod}_5 (n)$ be the remainder obtained when $n$ is divided by 5. Define a function $f: \{0,1,2,3,\dots\} \times \{0,1,2,3,4\} \to \{0,1,2,3,4\}$ recursively as follows:
\[f(i,j) = \begin{cases}\text{mod}_5 (j+1) & \text{ if } i = 0 \text{ and } 0 \le j \le 4 \text\\ f(i-1,1) & \text{ if } i \ge 1 \text{ and } j = 0 \text{, and} \\ f(i-1, f(i,j-1)) & \text{ if } i \ge 1 \text{ and } 1 \le j \le 4. \end{cases}\]
What is $f(2015,2)$
$\textbf{(A)}\; 0 \qquad\textbf{(B)}\; 1 \qquad\textbf{(C)}\; 2 \qquad\textbf{(D)}\; 3 \qquad\textbf{(E)}\; 4$

Solution:
Simply take some time to draw a table of values of $f(i,j)$ for the first few values of $i$
\[\begin{array}{|c || c | c | c | c | c |} \hline i \text{\ \textbackslash\ } j & 0 & 1 & 2 & 3 & 4\\ \hline\hline 0 & 1 & 2 & 3 & 4 & 0\\ \hline 1 & 2 & 3 & 4 & 0 & 1\\ \hline 2 & 3 & 0 & 2 & 4 & 1\\ \hline 3 & 0 & 3 & 4 & 1 & 0\\ \hline 4 & 3 & 1 & 3 & 1 & 3\\ \hline 5 & 1 & 1 & 1 & 1 & 1\\ \hline \end{array}\]
Now we claim that for $i \ge 5$ $f(i,j) = 1$ for all values $0 \le j \le 4$ .  We will prove this by induction on $i$ and $j$ .  The base cases for $i = 5$ , have already been proven.
For our inductive step, we must show that for all valid values of $j$ $f(i, j) = 1$ if for all valid values of $j$ $f(i - 1, j) = 1$
We prove this itself by induction on $j$ .  For the base case, $j=0$ $f(i, 0) = f(i-1, 1) = 1$ .  For the inductive step, we need $f(i, j) = 1$ if $f(i, j-1) = 1$ .  Then, $f(i, j) = f(i-1, f(i, j-1)).$ $f(i, j-1) = 1$ by our inductive hypothesis from our inner induction and $f(i-1, 1) = 1$ from our outer inductive hypothesis.  Thus, $f(i, j) = 1$ , completing the proof.
It is now clear that for $i \ge 5$ $f(i,j) = 1$ for all values $0 \le j \le 4$
Thus, $f(2015,2) = \boxed{1}$

Solution:
We are given that \[f(0,n) \equiv n+1\pmod{5} .\] Then, $f(1,n) = f(0, f(1, n-1)) \equiv f(1,n-1) + 1\pmod{5}$ . Thus $f(1,n) \equiv n+f(1,0)\pmod{5}$ . Since $f(1,0)=f(0,1)=2$ , we get \[f(1,n) \equiv n+2\pmod{5} .\] Then, $f(2,n) = f(1, f(2, n-1)) \equiv f(2,n-1) + 2\pmod{5}$ . Thus $f(2,n) \equiv 2n+f(2,0)\pmod{5}$ . Since $f(2,0)=f(1,1)=3$ , we get \[f(2,n) \equiv 2n+3\pmod{5} .\] Now $f(3,n) = f(2, f(3, n-1)) \equiv 2f(3,n-1) + 3\pmod{5}$ . Thus \begin{align*}     f(3,n) &\equiv 2f(3,n-1) + 3 &\pmod{5} \\     2f(3,n-1) &\equiv 2^2f(3,n-2) + 3\cdot 2 &\pmod{5} \\     \vdots \qquad &\quad\vdots \quad\qquad \vdots \qquad\qquad \vdots &\\     2^{n-1}f(3,1) &\equiv 2^nf(3,0) + 3\cdot 2^{n-1} &\pmod{5}  \end{align*} Adding them all up we get \[f(3,n) \equiv 3(2^n-1)\pmod{5} .\] This means that $f(3,0)=0$ $f(3,1)=3$ $f(3,2)=4$ $f(3,3)=1$ , and $f(3,4)=0$ . Thus $f(3,n)$ never takes the value 2.
Since $f(4,n)=f(3,f(4,n-1))$ , this implies that $f(4,n) \neq 2$ for any $n$ . By induction, $f(3,n) \neq f(3,2) = 4$ for any $n$ . It follows that $f(3,n) \neq f(3,4) = 0$ for any $n$ . Thus $f(4,n)$ only takes values in $\{1,3\}$ . In fact, it alternates between 1 and 3: $f(4,0)=f(3,1)=3$ , then $f(4,1)=f(3,f(4,0))=f(3,3)=1$ , then $f(4,2)=f(3,f(4,1))=f(3,1)=3$ , and so on.
Repeating the argument above, we see that $f(5,n) = f(4, f(5,n-1))$ can only take values in $\{1,3\}$ . However, $f(5,n-1)\neq 0$ for any $n$ implies that $f(5,n)\neq f(4,0)=3$ for any $n$ . Thus $f(5,n)=1$ for all $n$ . We can easily verify this: $f(5,0)=f(4,1)=1$ , then $f(5,1)=f(4,f(5,0))=f(4,1)=1$ , then $f(5,2)=f(4,f(5,1))=f(4,1)=1$ , and so on.
Then $f(6,0)=f(5,1)=1$ . Moreover, $f(6,n) = f(5,f(6,n-1)) = 1$ for all $n$ . Continuing in this manner we see that $f(m,n)=1$ for all $m\ge 5$
In particular, $f(2015,2) = \boxed{1}$


Answer: 1.0

For every real number $x$ , let $\lfloor x\rfloor$ denote the greatest integer not exceeding $x$ , and let \[f(x)=\lfloor x\rfloor(2014^{x-\lfloor x\rfloor}-1).\] The set of all numbers $x$ such that $1\leq x<2014$ and $f(x)\leq 1$ is a union of disjoint intervals.  What is the sum of the lengths of those intervals?
$\textbf{(A) }1\qquad \textbf{(B) }\dfrac{\log 2015}{\log 2014}\qquad \textbf{(C) }\dfrac{\log 2014}{\log 2013}\qquad \textbf{(D) }\dfrac{2014}{2013}\qquad \textbf{(E) }2014^{\frac1{2014}}\qquad$

Solution: Let $\lfloor x\rfloor=k$ for some integer $1\leq k\leq 2013$ .  Then we can rewrite $f(x)$ as $k(2014^{x-k}-1)$ .  In order for this to be less than or equal to $1$ , we need $2014^{x-k}-1\leq\dfrac1k\implies x\leq k+\log_{2014}\left(\dfrac{k+1}k\right)$ .  Combining this with the fact that $\lfloor x\rfloor =k$ gives that $x\in\left[k,k+\log_{2014}\left(\dfrac{k+1}k\right)\right]$ , and so the length of the interval is $\log_{2014}\left(\dfrac{k+1}k\right)$ .  We want the sum of all possible intervals such that the inequality holds true; since all of these intervals must be disjoint, we can sum from $k=1$ to $k=2013$ to get that the desired sum is \[\sum_{i=1}^{2013}\log_{2014}\left(\dfrac{i+1}i\right)=\log_{2014}\left(\prod_{i=1}^{2013}\dfrac{i+1}i\right)=\log_{2014}\left(\dfrac{2014}1\right)=\boxed{1}.\]


Answer: 1.0

For every subset $T$ of $U = \{ 1,2,3,\ldots,18 \}$ , let $s(T)$ be the sum of the elements of $T$ , with $s(\emptyset)$ defined to be $0$ . If $T$ is chosen at random among all subsets of $U$ , the probability that $s(T)$ is divisible by $3$ is $\frac{m}{n}$ , where $m$ and $n$ are relatively prime positive integers. Find $m$

Solution:
The question asks us for the probability that a randomly chosen subset of the set of the first 18 positive integers has the property that the sum of its elements is divisible by 3. Note that the total number of subsets is $2^{18}$ because each element can either be in or not in the subset. To find the probability, we will find the total numbers of ways the problem can occur and divide by $2^{18}$
To simplify the problem, let’s convert the set to mod 3:
\[U' = \{1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0\}\]
Note that there are six elements congruent to 0 mod 3, 6 congruent to 1 mod 3, and 6 congruent to 2 mod 3. After conversion to mod three, the problem is the same but we’re dealing with much simpler numbers. Let’s apply casework on this converted set based on $S = s(T')$ , the sum of the elements of a subset $T'$ of $U'$
$\textbf{Case 1: }S=0$
In this case, we can restrict the subsets to subsets that only contain 0. There are six 0’s and each one can be in or out of the subset, for a total of $2^{6} = 64$ subsets. In fact, for every case we will have, we can always add a sequence of 0’s and the total sum will not change, so we will have to multiply by 64 for each case. Therefore, let’s just calculate the total number of ways we can have each case and remember to multiply it in after summing up the cases. This is equivalent to finding the number of ways you can choose such subsets without including the 0's. Therefore this case gives us $\boxed{1}$ way.