I'm trying to figure out explicit definition for Sn (Sn is the n-th term, S1=1, S2=2, S3=3 S4=4 ... ), n>=1, for following infinite sequence of elements from the set {0,1}
(1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1…)
Any suggestions please? I see that number of 0s increases by one after each 1 but I can't seem to come up with way to derive the formula. Any tips would greatly help. Thank you.
More generally, if $a(n)$ is a strictly increasing sequence of positive integers, we want a sequence $b(n)$ such that $b(a(n)) = 1$ and $b(n) = 0$ otherwise.
In this case, $a(n) =\dfrac{n(n+1)}{2} $.
Let $c(n)$ be the inverse function of $a(n)$ so that $c(a(n)) = n$ and $c(n)$ is strictly increasing (though not necessarily integral).
In this case, $m =\dfrac{n(n+1)}{2} $ so $4n(n+1) = 8m$ or $(2n+1)^2 = 8m+1 $ so $n =\dfrac{\sqrt{8m+1}-1}{2} $. Therefore $c(n) =\dfrac{\sqrt{8n+1}-1}{2} $.
Since $a(n)$ is strictly increasing, $c(n)$ is increasing, though not necessarily strictly. In particular, for $a(n) \le m \lt a(n+1)$, $n = c(a(n)) \le c(m) \le c(a(n+1)) =n+1 $ so $c(m) = n$ for $a(n) \le m \lt a(n+1)$.
Therefore, $c(m)$ is an integer then $b(m) = 1$ and $b(m) =0$ otherwise. Playing around, this can be written as $b(m) =1-\lceil c(m)-\lfloor c(m) \rfloor \rceil $.
In this case, $b(m) =1-\lceil \dfrac{\sqrt{8m+1}-1}{2}-\lfloor \dfrac{\sqrt{8m+1}-1}{2} \rfloor \rceil $.