5
$\begingroup$

I'm looking for a series that will give me 1,1,-1,-1,1,1,-1,-1 ......

The best I came up with is:

$a_n =sin(n\pi/2)+cos(n\pi/2)$

But I am looking for something more elegant. It is important that it will suit for all $n>=0$

$\endgroup$
1
  • 4
    $\begingroup$ I think most mathematicians would consider $\sin(n\pi/2) + \cos(n\pi/2)$ to be needless obfuscation, even if it's done for the (questionable) purpose of providing a unified closed-form expression. Probably: $$a_n = \begin{cases} 1, & n \equiv 0~\mathrm{or}~1 \pmod{4}; \\ -1, & n \equiv 2~\mathrm{or}~3 \pmod{4} \end{cases}$$ would be the clearest way to express it. $\endgroup$ Jun 16, 2017 at 19:12

4 Answers 4

14
$\begingroup$

$$u_n=(-1)^{\lfloor \frac {n}{2}\rfloor} $$

or $$u_{2n}=u_{2n+1}=(-1)^n $$

$\endgroup$
6
$\begingroup$

I found the formula $$u_n = i^{n(n-1)}$$ on the OEIS. It's credited to Bruno Berselli, 2010.

$\endgroup$
3
  • 2
    $\begingroup$ $(-1)^{n(n-1)/2}$ seems a more logical way to write it. $\endgroup$ Jun 16, 2017 at 22:34
  • 2
    $\begingroup$ @eyeballfrog More logical? Logic isn't a continuum; either it's logical or it's not. $\endgroup$
    – B. Goddard
    Jun 16, 2017 at 22:55
  • 2
    $\begingroup$ @eyeballfrog this would be a nice answer. $\endgroup$
    – miracle173
    Jun 16, 2017 at 23:34
2
$\begingroup$

$a_n = \sqrt{2} \sin[(2n+1)\pi/4]$

$\endgroup$
2
  • 1
    $\begingroup$ it is a same as the OP mentioned $\endgroup$
    – haqnatural
    Jun 16, 2017 at 22:33
  • $\begingroup$ i understand your point, but here we have only one trig function involved. $\endgroup$ Jun 16, 2017 at 22:44
0
$\begingroup$

$$u_0=1$$

$$u_n=(-1)^{n-1}u_{n-1} $$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .