Why does $f(x) = \sum_{n=1}^{\infty}(1/(x^{\mathrm{prime}(n)})$ have a local maximum?

We played around with https://en.wikipedia.org/wiki/Prime_constant this equation a bit and got to this by playing:

$y = f(x) = \sum_{n=1}^{\infty}\frac{1}{x^{\mathrm{prime}(n)}}$

where $\mathrm{prime}(n)$ returns the $n$th prime.

To this formular, we've got 2 questions. First, when doing it with x = 10, we seemingly get it in binary format directly instead of the need to convert it first (what the equation on wikipedia with x = 2 needs). But we haven't been able to convert to any other bases. So, why do 2 and 10 work, but 3 isn't convertable to any other base? (Seemingly! We're far from being experts on floating point numbers and conversion!).

Also, maybe even more interesting, When plotting this up to, say, 100 000, we saw that it has a local maximum in the negative somewhere around between the $x$ values -2,19 and -2,185.

The questions we wondered about:

• Why does base-conversion only work between $x = 2$ and $x = 10$?
• Why does this maximum occur? We don't see the reason for this.
• Where exactly is the local maximum (the local maximum around $x=-2.19$ that is) and how to calculcate that? Is it somehow deducible from other known mathematical constants? (Like, say, $\frac{\pi}{2}$ or something like that).
• Does this local maximum occur if we put $n = \infty$? We can only play around with numbers and not proof that kind of stuff here since we don't know how to handle the prime-function.

When plotting this function, we first thought we made an error, but WolframAlpha ( https://www.wolframalpha.com/input/?i=f(x)+%3D+sum+x%5E-Prime%5Bn%5D,+n%3D1+to+10 ) seems to plot roughly the same maximum (of course, with smaller $n$-vaues in the example link).

$f(10) = 1/10^2 + 1/10^3 + 1/10^5 + \ldots = 0.01101\ldots$. Each term $1/10^p$ corresponds to a digit $1$ in the decimal expansion of this number, the rest of the digits being $0$. It may look like "binary format" to you, but it's just decimal where the digits are $0$'s and $1$'s.

EDIT: $$f'(x) = - \sum_{n=1}^\infty \text{prime}(n) x^{-\text{\prime}(n)-1}$$ Note that when $x < 0$, $x^{-\text{prime}(n)}$ is positive for $n=1$ and negative otherwise. We have $f'(-2.19) \approx 0.00029987$ and $f'(-2.185) \approx -0.00049086$, so there will be a local max somewhere between those. It won't have a closed form.

When x is negative, the only positive term is $1/x^2$ because that is the only even prime.
That term dominates all the others when $x$ is large and negative. As $x$ shrinks, $1/x^2$ grows bigger, and you see the sum increase. But the negative terms also grow, and somewhere $1/x^2$ no longer dominates. By the time $x=-1$, the sum is $1-1-1-1-1...$ and the negative terms dominate The tipping point seems to be $-2. 19$.
I can't see a way to calculate that number.

As Robert pointed out, you can find the local maxima around $x=-2.19$ by differentiating $f$. Concerning the values of your function $f$ at positive integers $x$, these correspond to the base-$x$ representations of the prime constant.

Let $\chi_\mathbb{P}$ denote the characteristic function of the primes, i.e., the function such that for positive integer $n$:

$$\chi_\mathbb{P}(n):={\begin{cases}1&{\text{if }}n\in \mathbb{P},\\0&{\text{if }}n\notin \mathbb{P},\end{cases}}}$$

where $\mathbb{P}$ denotes the set of prime numbers. Now let $\rho$ denote the prime constant. We have:

$$\rho =\sum _{{p}}{\frac {1}{2^{p}}}=\sum _{{n=1}}^{\infty }{\frac {\chi _{{{\mathbb {P}}}}(n)}{2^{n}}}=f(2).$$

By letting $\rho_x$ denote the base-$x$ representation of the prime constant, we have:

$$\rho_x =\sum _{{p}}{\frac {1}{x^{p}}}=\sum _{{n=1}}^{\infty }{\frac {\chi _{{{\mathbb {P}}}}(n)}{x^{n}}}=f(x).$$

The decimal expansion of $\rho$ begins with: \begin{align} \rho&=0.011010100010100010_2\\ &=0.414682509851111660248109622\ldots . \end{align}

and is included in the OEIS as sequence A051006. Other values, for instance $x=3$ can be easily computed:

\begin{align} f(3)=\sum _{{p}}{\frac {1}{3^{p}}}&=\rho_3 \\ &=0.011010100010100010_3 \\ &=0.152726266\ldots. \end{align}