# Thread: expression to result in -1 or 1

1. ## expression to result in -1 or 1

Is there an expression that results in -1 or 1 for these values of n:
1 -> -1
2 -> -1
3 -> 1
4 -> 1
5 -> -1
6 -> -1
7 -> 1
8 -> 1
9 -> -1
10 -> -1
etc.
My book has something that does not work correctly.

2. ## Re: expression to result in -1 or 1

Originally Posted by Stuck Man
Is there an expression that results in -1 or 1 for these values of n:
1 -> -1
2 -> -1
3 -> 1
4 -> 1
5 -> -1
6 -> -1
7 -> 1
8 -> 1
9 -> -1
10 -> -1
etc.
My book has something that does not work correctly.
$a_n = \left( { - 1} \right)^{\left\lfloor {\frac{{n + 1}}{2}} \right\rfloor }$ where $\left\lfloor {\frac{{n + 1}}{2}} \right\rfloor$ is the floor function (greatest integer function).

3. ## Re: expression to result in -1 or 1

Originally Posted by Stuck Man
Is there an expression that results in -1 or 1 for these values of n:
1 -> -1
2 -> -1
3 -> 1
4 -> 1
5 -> -1
6 -> -1
7 -> 1
8 -> 1
9 -> -1
10 -> -1
etc.
My book has something that does not work correctly.
I am 'enthusiast' of circular functions so that I propose...

$a_{n}= \sqrt{2}\ \sin (1-2n)\ \frac{\pi}{4}$ (1)

Kind regards

$\chi$ $\sigma$

4. ## Re: expression to result in -1 or 1

Is that often featured on calculators? I don't think I've seen it before although I've heard of it in computer languages.

5. ## Re: expression to result in -1 or 1

Originally Posted by Stuck Man
Is that often featured on calculators? I don't think I've seen it before although I've heard of it in computer languages.
I know nothing about calculators, but on a CAS it is floor(x).
Look at this webpage.