-1

Give a general formula for nth element of the sequence 1, 1, 0, 1, 1, 0, 1, 1, 0, ...

I have been trying any combination, but I can't find a solution.

J. W. Tanner
  • 63,683
  • 4
  • 43
  • 88

3 Answers3

2

How about $a_n=\dfrac43\sin^2\left(\dfrac{n\pi}3\right)$?

J. W. Tanner
  • 63,683
  • 4
  • 43
  • 88
2

I think $a_n =1-\frac{1}{3}\left(1+e^{\frac{2i\pi}{3}n}+e^{\frac{4i\pi}{3}n}\right)$ works.

  • 2
    I think that works too; $+1$ – J. W. Tanner Dec 09 '20 at 17:08
  • @Jet Chung trying it on excel but it gives me an error

    =1-(1/3)(1 + EXP(((COMPLEX(0,2)PI())J8/3)J8)+EXP(((COMPLEX(0,4)PI())J8/3)*J8))

    I'm probably writing the formula incorrectly

    – M. Carlo Bramini Dec 09 '20 at 18:00
  • I'll mark your correct if the answer is more accurate – M. Carlo Bramini Dec 09 '20 at 18:03
  • @Luther I don't really know how to use Excel, but a quick Google search tells me COMPLEX(COS(2PI()J8/3), SIN(2PI()J8/3)) and COMPLEX(COS(4PI()J8/3), SIN(4PI()J8/3)) should work. –  Dec 09 '20 at 20:08
  • Where I'm using $e^{i\theta} = \cos{\theta} + i \sin(\theta)$. –  Dec 09 '20 at 20:10
  • This seems to work in Google sheets (I assume it would work the same in Excel): =COMPLEX(ROUND(2/3-(COS(2PI()/3A1)+COS(4PI()/3A1))/3, 5), ROUND((SIN(2PI()/3A1)+SIN(4PI()/3A1))/3,5)) –  Dec 09 '20 at 20:26
0

If $n$ is divisible by $3$, then $a_n=0$. Otherwise, $a_n=1$.

So, the formula $a_n=\min(n \bmod 3,1)$ should work.