Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm thinking about this question in the sense that we often have a term $(-1)^n$ for an integer $n$, so that we get a sequence $1,-1,1,-1...$ but I'm trying to find an expression that only gives every 3rd term as positive, thus it would read; $-1,-1,1,-1,-1,1,-1,-1...$

Alternatively a sequence yielding $1,1,2,1,1,2,1,1,2...$ could also work, as $n$ could just be substituted by it in $(-1)^n$

share|cite|improve this question
4  
Check this out. – Eff 11 hours ago
1  
For $-1,-1,1,-1,-1,1,\ldots$ you can use $(-1)^{n^2\bmod 3}$. – user236182 11 hours ago
    
can you use floor function? – G Cab 11 hours ago
    
I first started by trying to find a floor-function representation, and came up short. – Kristaps John Balodis 10 hours ago
    
Well, f(n) = 1 if $3|n$ and f(n) = -1 if $3 \not \mid n$ is a perfectly legitimate function. For something less "if then" $(-1)^{\lceil (n/3 - \lfloor n/3\rfloor)\rceil}$ but that just point the "if then" burden where no-one sees it. Still there are better ones. – fleablood 10 hours ago

12 Answers 12

Let $F_n$ be the Fibonacci sequence $0,1,1,2,3,5,8,13,21,34,...$ then a possible sequence is $$(-1)^{F_{n+1}}$$

share|cite|improve this answer
1  
nice observation! – BigbearZzz 11 hours ago
5  
I like the specific use of Fibonacci. I think a recursive function might even give the OP a direct route, say starting with $1,-1,...$ and then using product of previous two entries. – Nij 9 hours ago

How about $$a_n=\frac 23\cos\left(\frac{2\pi n}3\right)+\frac 43\ $$

share|cite|improve this answer

If you want something purely in terms of elementary operations, you could use the closed form:

$$\frac{2}{3}\left(-\frac{1}{2} + \omega^n + \omega^{2n}\right)$$

Where $\omega=\frac{-1+\sqrt{3}i}{2}$ is a complex cube root of unity. When $3|n$ we get $\omega^n =\omega^{2n} = 1$. On the other hand, when $n$ is not divisible by $3$, $\omega^n$ and $\omega^{2n}$ will be the two roots of the polynomial:

$$z^2 + z + 1$$

And from Vieta we get $\omega^n + \omega^{2n} = -1$.

share|cite|improve this answer

You can check out OEIS which gives you several ways to generate your sequence.

share|cite|improve this answer
1  
It should be oeis.org/A177702. – user236182 11 hours ago
1  
@user236182 mostly irrelevant as the one can be obtained from the other via a shifted index. – JMoravitz 11 hours ago
1  
Right, but it's still a better link in this case. – user236182 11 hours ago
    
@user236182 Thanks, edited. – pi66 11 hours ago

You could use a simple trig function whose period is $3$. We can therefore try a function of the form $$f(x)=a\cos\left(\frac{2\pi x}{3}\right)+b$$

Substituting the coordinates $(0,2),(1,1)$ gives the values of $a,b$ and we end up with $$f(x)=\frac 23\cos\left(\frac{2\pi x}{3}\right)+\frac 43$$ and this generates the required sequence.

share|cite|improve this answer

Let $\omega \neq 1$ be a cubic root of unity. We have that $1 + \omega + \omega^2 = 0$, i.e. $\omega + \omega^2 = -1$. Also, $w^{-1} = \omega^2$ and $\omega^3 = 1$.

Put $a_n = \omega^n + \omega^{-n}$. We get the sequences

\begin{eqnarray*} a_0 &=& \omega^{0} + \omega^{0} = 2 \\ a_1 &=& \omega^{1} + \omega^{-1} = \omega^{1} + \omega^{2} = -1 \\ a_2 &=& \omega^{2} + \omega^{-2} = \omega^{2} + \omega^{1} = -1 \\ \end{eqnarray*}

and then the sequence repeats.

If you put $b_n = \frac{2 a_n -1}{3}$, then you get $1, -1, -1, 1, -1, -1, \cdots$.

share|cite|improve this answer

$$-1+2\left \lfloor {\frac n 3} \right \rfloor -2\left\lfloor \frac {n-1}3 \right\rfloor $$ , where $n$ starts from $1$.

share|cite|improve this answer
    
Computationally the most efficient function here I think. Nice one. – tomsmeding 3 hours ago
    
@tomsmeding Thanks! – Kay K. 3 hours ago

$a(0) = a(1) = -1$
$a(n) = a(n-1) * a(n-2)$

share|cite|improve this answer

How about $\operatorname{Re}\left(e^{\tfrac{2}{3}\pi i n}\right)$?

share|cite|improve this answer
8  
$n=1$ would give $-\frac{1}{2}$, which doesn't correspond to any member of any of the sequences. And also, you can just write $\cos\left(\frac{2}{3}\pi n\right)$. A lot less complicated. – user236182 10 hours ago

How about:

$$(n\bmod3)^2-3(n\bmod3)+1$$

share|cite|improve this answer

$$(-1)^{(n\,\text{mod}\, 3)!}$$

Edit. a simpler solution, without a factorial and starting with $n=2$:

$$(-1)^{(n\,\text{mod}\, 3)+1}$$

share|cite|improve this answer
    
Why exponentiate when $(n\pmod 3)!$ gives an equivalent solution? – Nij 5 hours ago
    
@Nij that's for the sequence 1,1,2,1,1. But I realized that you don't even need the factorial. – Pulsar 5 hours ago
    
The factorial does matter if used as exponent, but not when used directly, to be clear. 0, 1, 2 gives 1, -1, 1. But 0!, 1!, 2! gives 1, 1, 4. Used as exponents they then return 1, -1, 1 versus -1, -1, 1. – Nij 3 hours ago

Here is my proposal, for $n \ge 1$:

$$1+\left\lfloor \frac{1}{n^{(n \pmod {3})}} \right\rfloor - \left\lfloor \frac{1}{n}\right\rfloor$$

It will provide the sequence: $\{1,1,2,1,1,2,...\}$

share|cite|improve this answer
    
@CiaPan thanks for the change, I did not know that formatting option! – iadvd 2 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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