1
$\begingroup$

I'm trying to figure out a general formula for any term $x_{n}$ in the sequence

$(x_n)=(0,1,0,1,1,0,1,1,1,0,1,1,1,1,0...)$

where the $k^{th}$ zero is followed by $k+1$ ones.

All I've been able to figure out is that the kth zero's position in the sequence can be found using
$0_k = x_\frac{k(k+1)}{2}$

  • 2
    $x_n=0$ if $n=k(k+1)/2$ for some positive integer $k$, and $x_n=1$ otherwise, is not an acceptable formula?2017-02-11
  • 0
    @JonasMeyer: This is already present in the question, the OP is probably looking for an algebraic formula - which most probably doesn't exist.2017-03-17

2 Answers 2

2

The formula $$x_n=\frac12+\frac12(-1)^{\Large{1+\lceil\sqrt{1+8n}\rceil-\lfloor\sqrt{1+8n}\rfloor}}$$

works, because $n\in\mathbb N$ is a triangular number if and only if $\sqrt{1+8n}$ is a whole number, as $n=\frac{k(k+1)}{2}$ is equivalent to $k=\frac12(-1+\sqrt{1+8n})$.

  • 0
    Excellent. Wow.2017-03-21
0

Partial answer: You could try a solution like $x_n=H\left(a+b\{c+d\sqrt{n+e}\}\right)$, where $H(\cdot)$ is the Heaviside step function, $\{\cdot\}$ is the fractional part function, and $a$, $b$, $c$, $d$, and $e$ are appropriately chosen constants. I'm fairly confident that something like this will work. But finding a simple, correct combination of constants may be tedious.