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?

  • 1
    $\begingroup$ $f(4)=2^1+2^2+2^3+2^4$ $\endgroup$ – Dr. Sonnhard Graubner Jul 19 '15 at 15:59
  • $\begingroup$ what about $\sum_{i=1}^{n}2^i$ $\endgroup$ – Cardinal Jul 19 '15 at 16:00
  • 1
    $\begingroup$ Did you try $f(n) = 2^{n+1}-2$? $\endgroup$ – jbuddenh Jul 19 '15 at 16:05
  • 3
    $\begingroup$ it must be $$f(n)=2^{n+1}-2$$ $\endgroup$ – Dr. Sonnhard Graubner Jul 19 '15 at 16:06

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}$$


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$.

  • 3
    $\begingroup$ Ok, this was exactly what I was looking for. Feeling a little ashamed right now that I didn't come up with this myself. Thanks! $\endgroup$ – Rolf van de Krol Jul 19 '15 at 16:06
  • $\begingroup$ You're welcome! My pleasure. $\endgroup$ – Mark Viola Jul 19 '15 at 16:07
  • $\begingroup$ @Dr.MV I changed the link so that it goes directly to the relevant formula. I hope this is agreeable. $\endgroup$ – Omnomnomnom Jul 19 '15 at 16:09
  • $\begingroup$ @Omnomnomnom Absolutely! No worry. I just didn't see any part of the text that was edited recognizably and was baffled. $\endgroup$ – Mark Viola Jul 19 '15 at 16:10
  • $\begingroup$ Of course if you add $g(x)=\sin (2\pi x)$ or a similar function to your solution, that would be a new "solution" (at least in the sense that it is continuous (even analytic) and has the right values at the natural numbers). $\endgroup$ – Jeppe Stig Nielsen Jul 20 '15 at 14:50

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:





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


HINT: $$\sum_{i=1}^n 2^i=2(2^n-1)$$


The other answers show you how to derive the function $f(x) = 2^{x+1} - 2$, but I'm just going to show how the problem is approached (in complete unrigorous terms). I know from experience how magical it seems that the above answers just managed to come up with the right function all of a sudden.

So, we look at the problem and we can see that it's forming a pattern $2, 6, 14, 30, \ldots$ - now this reminds us of something, all the numbers seem to be even, but if you look hard enough they are all $2$ less than powers of $2$. So we can see that really, the sequence is actually $$2^2 - 2, 2^3 - 2, 2^4 - 2, 2^5 - 2, \ldots$$

From this, it's pretty obvious to us that we should start thinking that this problem is related to something like $2^{\text{something}} - 2$ and once you know what to arrive at it makes getting there a whole lot easier, which is where the other answers come in.

  • 1
    $\begingroup$ "Looking for patterns" in this way makes it easy to fall victim to the "strong law of small numbers." That being said, it sometimes helps us make an educated guess. $\endgroup$ – Omnomnomnom Jul 19 '15 at 16:13
  • $\begingroup$ @Omnomnomnom, Like I said, this is more just to provide a direction of where to start looking in, so you can see that the problem is related to $2^x$ so you can start going in that direction. If that direction works, perfect! If not, at least you've learnt something and you can try some other tactic. $\endgroup$ – Zain Patel Jul 19 '15 at 16:15
  • 1
    $\begingroup$ Still, I object to the phrasing that it's "pretty obvious" that the formula holds because it happens to fit the first 5 values. $\endgroup$ – Omnomnomnom Jul 19 '15 at 16:18
  • $\begingroup$ @Omnomnomnom, fair enough. I've edited my answer. :-) $\endgroup$ – Zain Patel Jul 19 '15 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.