For every natural number $n$, $f(n) =$ the smallest prime factor of $n.$ For example, $f(12) = 2, f(105) = 3$ 
QUESTION: Let $f$ be a continuous function from $\Bbb{R}$ to $\Bbb{R}$ (where $\Bbb{R}$ is the set of all real numbers) that satisfies the following property:


For every natural number $n$, $f(n) =$ the smallest prime factor of $n.$ For example, $f(12) = 2, f(105) = 3.$ Calculate the following-


$(a)\lim_{x→∞}f(x)$


$(b)$ The number of solutions to the equation $f(x) = 2016$.


MY SOLUTION: I do not have a problem in understanding part $(a)$. Clearly, $\infty$ is not a number and we cannot find any smallest prime factor for it. Or we can also argue that for any even number-
$f(even)=2$
And for any odd number it depends on the type of the odd number.. in case it's prime then $f(prime \space x)=x$ and in case it's not prime then the answer is something else..
Anyway, we find that there are numerous possibilities and since all of these possibilities directly depend on the number we have chosen so, we cannot account for what happens in the case of $\infty$.
Coming to the second part, the question itself bounced over my head. Let's see carefully what it says-
We know, $f(x)=$ the smallest prime factor of $x$. Therefore, $f(x)=2016$ must imply (by the same logic that)-
The smallest prime factor of $x$ is $2016$.
Wait. What?! Firstly, 2016 is not prime. So how can I account for $x's$ which have such an impossible prime factor.. secondly, even if we assume that $2016$ is the smallest factor of $x$ there are infinite $x's$ which satisfies such a property. Our answer in that case is not bounded (although it's nowhere mentioned it should be)..
So what does the second part even mean? 
Thank you in advance for your kind help :).
 A: For a, you can conclude that the limit does not exist.  As you say, $f(n)=2$ for even $n$ and $f(n) \ge 3$ for odd $n$.  If you think of the $N-\epsilon$ definition of a limit at infinity, this function will fail to have a limit and you can choose any $\epsilon \lt \frac 12$ to demonstrate that.
For b, you are expected to use the fact that $f(x)$ is continuous and use the intermediate value property.  We have $f(2016)=f(2018)=2$ and $f(2017)=2017$ because $2017$ is prime. There must be at least one number in the intervals $(2016,2017)$ and $(2017,2018)$ where the function is $2016$.  As there are infinitely many primes greater than $2016$, there will be infinitely many points where $f(x)=2016$, at least one each side of each of these primes.
A: Your forget that $x$ need not be an integer.
There are an infinite number of prime numbers larger than $2016$.
If $p$ is a prime number larger than $2016$ then $p-1$ is even and $p+1$ is even.
So $f(p-1) = 2$ and $f(p) = p > 2016$.  And $f(p+1) = 2$.
And $f$ is continuous. So by the intermediate value theorem, there are $x_1, x_2$ that are NOT integers so that $p-1 < x_1 < p < x_2 < p+1$ where $f(x_1) = f(x_2) = 2016$.
So there are infinitely many such solutions.  At least countably many  bu possibly uncountable manny as there is no reason we can't have $n < a < b < n+1$ and $f(x) =2016$ for all $a\le x \le b$..
====
For the first part.
There are possible ways the $\lim_{x\to \infty} f(x)$ can behave.

*

*$\lim_{x\to \infty} f(x) = \infty$.

This means for any real value $K$ no matter how large, there there will be some point $N$ beyond which $f(x) > K$ for all $x > N$.  In other words, we can make $f(x)$ get as large as we like, and stay as large as we like, by taking $x$ large enough.
THis is not the case.
No matter have far we make $N$ out there will always an even $n > N$ so that $f(n) =2$ so we can't make $f(x)$ as large as we like and stay that large be picking $x$ large enough.


*$\lim_{x\to \infty} f(x) = -\infty$.  This is basically very similar to 1).  For any real value $K$, no matter how small, the well always be a point $N$ beyond which for all $x > N$ we will have $f(x) < K$.

This is not the case.  For all $N$ we can always find so $n>N$ where $n$ is even and $f(n) =2$ so we can't force $f(x)$ to be as small as we like.  No matter how far out there will always be an $x$ further out where $f(x) =2$ and we can't force it to always be smaller.


*$\lim_{x\to \infty} f(x) = c$ for some real value $c$.

This means we can force $f(x)$ to get as close as we like to $c$, that is for any $\epsilon >0$, no matter how small, there is a point $N$ beyond which whenever $x > N$ then we will have $f(x)$ within a distance of $\epsilon$ of $c$.  That is to say, whenever we have $x > N$ we will have $|f(x)-c| < epsilon$.
And that is not the case.
no matter how far out we go, we will always have even $n$ where $f(n) =2$ and very large prime $p$ where $f(p)= p$ and the is no value of $c$ that is close to both $2$ and close to large prime $p$.
Moe formally, what Ross Millikan was getting at is if $\epsilon < 1$.  And and then there can not be an $N$ so that if $x > N$ we will always have $|f(x) - c| < 1$.
After all , there will be even $n > N$ so that $f(n)=2$.  And there will be prime $p> 5$ where $f(p) = p$.  And we can't have both $|f(n) -c|=|2-c|< 1$ and $|f(p) -c|= |p-c|< 1$ if $p>5$.
Why not.  If $|2-c|< 1$ then $1< c< 3$.  And if $|p-c|< 1$ then $4\le p-1 < c< p+1$.  And those both can't be true.


*$\lim_{x\to\infty}f(x)$ does not exist.

This happens if none of the three above are true.
And.... none of three above are true.
So $\lim_{x\to\infty}f(x)$ does not exist.
A: We use Intermediate Value Theorem to show that there are in fact infinitely many solutions to $f(x)=2016$.
Let $p>2016$ be a prime. Then $f(3)=3$ and $f(p)=p$. Hence by IVT $\exists$ $x\in[3,p]$ such that $f(x)=2016$. Note that $f(3^m)=3$ and $f(p^k)=p$ for any positive integers $m,k$. Choose two sequences of positive integers $(a_n)$ and $(b_n)$ such that $$3^{a_1}<p^{b_1}<3^{a_2}<p^{b_2}<\ldots <3^{a_n}<p^{b_n}<3^{a_{n+1}}<p^{b_{n+1}}\ldots$$ Then each interval $I_n=[3^{a_n},p^{b_n}]$ contains one solution to $f(x)=2016$. Since the intervals $I_n$ are pairwise disjoint we have infinitely many solutions to $f(x)=2016$.
