Let $f$ be the function such that:

$\large \begin{cases} 2x & \text{ if } x\le \frac{1}{2} \\ 2-2x & \text{ if } x > \frac{1}{2} \end{cases}$

What is the total length of the graph of $\underbrace{f(f(\dots f(x)}_{2018 f's}\dots))$ from $x=0$ to $x=1?$

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

When there are $n$ copies of $f$ , the graph consists of $2^n$ segments, each of which goes to $\frac{1}{2^n}$ units to the right, and alternately $1$ unit up or down. So the length is:

$2^n\sqrt{1+\frac{1}{2^n}} = \sqrt{4^n+1}$ ,

Taking $n=2018$ , the answer is $\sqrt {4^{2018} +1}$ .