Function that looks a lot like exponential, but isn't

I'm looking for a continuous function f(x) with the following properties. I've been playing with exponentials, but that doesn't seem to be the answer, although my high school mathematics is a bit rusty, I must admit.

  • $f(1) = 2$
  • $f(2) = 6 = 2+4$
  • $f(3) = 14 = 2+4+8$
  • $f(4) = 30 = 2+4+8+16$
  • And so on

I'm looking for a continuous function, so something with a meaningful answer for $f(2.5)$, which is less then $6 + \frac{14 - 6}{2} = 10$.

My simple high school math made me look at something like $f(x) = a^x$, but that doesn't seem to be the answer.

Any better ideas?


Solution 1:

We have for the sequence $f(n)$

$$\begin{align} f(n)&=\sum_{k=1}^n2^k\\\\ &=2^{n+1}-2\tag 1 \end{align}$$

where we summed a Geometric Progression to arrive at $(1)$.

Thus, the continuation of $f$ for real arguments is

$$\bbox[5px,border:2px solid #C0A000]{f(x)=2^{x+1}-2}$$


NOTE:

We remark that the continuation is not unique inasmuch as we can add any continuous functions that has zeros for each integer. As example, the function $g(x)=2^{x+1}-2+C\,\sin ( \pi x)$, where $C$ is any constant, is continuous and for all integer-valued arguments $n$, is given by $g(n)=2^{n+1}-2$ since $\sin (n\pi)=0$ for all integer values of $n$.

Solution 2:

If you're computer-minded, it might seem natural to express these numbers in binary, since they're sums of powers of two!

Then you see that they're:

$$f(1)=10_2$$

$$f(2)=110_2$$

$$f(3)=1110_2$$

$$f(4)=11110_2$$

and it's immediately apparent that adding $10_2$ to these will give powers of two.