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$
  • 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$ – Daniel Schepler Jun 16 '17 at 19:12
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$
  • 1
    $\begingroup$ $(-1)^{n(n-1)/2}$ seems a more logical way to write it. $\endgroup$ – eyeballfrog Jun 16 '17 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 '17 at 22:55
  • 1
    $\begingroup$ @eyeballfrog this would be a nice answer. $\endgroup$ – miracle173 Jun 16 '17 at 23:34
2
$\begingroup$

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

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

$$u_0=1$$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.