Does the sequence $1,-1,1,1,-1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,1,-1,\ldots$ have a closed form? 
Question : Can we represent the following sequence $\{a_n\}\ (n\ge 0)$ as a closed form?$$a_n : 1,-1,1,1,-1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,1,-1,\ldots$$ Suppose that there exist ${(i+1)}$ $1_s$ between the $i_{th}$ $(-1)$ and ${(i+1)}_{th}$ $(-1)$ for $i=1,2,\cdots$.

Though I've thought about this, I'm facing difficulty. Can anyone help? A simpler form is better if closed forms exist.
Motivation : I've known that a periodic sequence can be represented as a closed form. For example, if a sequence $\{b_n\}\ (n\ge0)$ is defined as
$$b_n : 1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,1,-1,\ldots,$$
(Suppose that $b_n=-1\ (n\equiv 4),b_n=1\ (n\not\equiv 4)\ ($mod$ 6$))
then we can represent $\{b_n\}$ as
$$b_n=\frac 13\left(2+(-1)^n+2\cos\frac{n\pi}{3}-2\cos\frac{2n\pi}{3}\right).$$
Then, I got interested in the above sequence $\{a_n\}$. I'm facing difficulty because $\{a_n\}$ is not periodic. 

To start with, we want a function $f:\mathbb R \rightarrow  \{0,1\}$ that can tell integers from non-integers. For instance:
$$f(x) = \lceil x \rceil - \lfloor x \rfloor$$
which is $0$ or $1$ according as $x$ is an integer or not.
Next, we want a function $g:\mathbb N \rightarrow \mathbb R$ that is an integer only when its argument is in $\{1,4,8,13,19,\ldots\}$ (i.e. when $a_n = -1$). For instance:
$$g(n)=\sqrt{8n+17}$$
Now it's easy: just take $a_n = 2f(g(n)) - 1$.
