3

I'm trying to plot $2\operatorname{floor}\left(\log_{2}x\right)+1$ but only if $x$ is a natural number.
Desmos plots correctly
$2\operatorname{floor}\left(\log_{2}x\right)+1$
enter image description here

I would like this however:

enter image description here

I achieved this using a list of points $[(1,1),(2,3),(3,3),(4,5)\ldots]$ but I would like to plot up to infinity and I don't think desmos supports list comprehensions like that.

So instead I tried using desmos-style piecewise functions like $y=\left\{\operatorname{mod}\left(x,1\right)=0:2\operatorname{floor}\left(\log_{2}x\right)+1\right\}$ but this has no output at all.

So, how can I create a graphic like the second for all natural $x$? (At least up to $x=2^{2700}$)

Asaf Karagila
  • 393,674
minseong
  • 1,293

1 Answers1

4

This will get you what you want.

enter image description here

The idea is to define a function, then plot points using a list.

In this case, we define a function $$f(x)=2\text{floor}(\log_2x)+1$$ and make the calculator plot points $(a,f(a))$ where $a\in(1,2,3,...)$.

Andrew Chin
  • 7,389