# How to represent the $n$th number in the sequence $1,3,5,7,1,3,5,7,\dots$ as a closed form?

I'm given the repeating sequence $1,3,5,7,1,3,5,7,\dots.$ I must determine a formula for the $n$th term of the sequence.

I have tried the triangle method, but since this is a repeating series it is not working.

-
And what is your question? –  abiessu Sep 18 '13 at 23:42
In addition to asking a question, you might talk about the "triangle method" because I've never heard of anything with that name. –  Eric Stucky Sep 18 '13 at 23:45
@EricStucky I would guess that OP means finding the binomial transform, which can be done with a triangle-shaped diagram of successive differences. It works great for finding equations to some sequences, but not here –  Cocopuffs Sep 19 '13 at 0:01

This is a different question than your previous one. In this case, it appears the blocks are all four positions long. So I would say $2[n \pmod 4]+1$ if we start counting $n$ at zero.

-

There is a way to get a formula for the sequence that allows you to simply plug in a number. Let's call this number $n$. We'll start with something simple and build up to the grand finale of four numbers.

Then, the idea is to start with something that repeats. For example, $(-1)^n$ repeats. Its sequence goes $1,-1,1,-1,\dots$

So if we take $\displaystyle\frac{(-1)^n+1}{2}$ we get $1,0,1,0,\dots$ We can then multiply this by a number to get a sequence that repeats this number. So we have:

$$a\cdot\displaystyle\frac{(-1)^n+1}{2} = a,0,a,0,\dots$$

Next, we change the power of $n$, by adding one to it. This gives $\displaystyle\frac{(-1)^{\color{red}{n+1}}+1}{2}$, and we can then get:

$$b\cdot\displaystyle\frac{(-1)^{n+1}+1}{2} = 0,b,0,b,\dots$$

$$a\cdot\displaystyle\frac{(-1)^n+1}{2} + b\cdot\displaystyle\frac{(-1)^{n+1}+1}{2} = a,b,a,b,\dots$$

To get a sequence of four numbers, we use something that repeats every four terms. This number is $(e^{2 \pi i/4})^n$, where $e$ is the exponential, and $i$ is the imaginary number unit. The sequence goes $1, i, -1, -i, 1, i, -1, -i,\dots$

The next trick is to eliminate part of this sequence. If we take the cosine of this number, we get

$$\cos{\left((e^{2 \pi i/4})^n \right)} = 1, 0, -1, 0, 1, 0, -1, 0,\dots$$ $$c \cdot \cos{\left((e^{2 \pi i/4})^n \right)} = c, 0, -c, 0, c, 0, -c, 0,\dots$$

Again, if we add one to the power, we get:

$$d \cdot \cos{\left((e^{2 \pi i/4})^{n+1} \right)} = 0, -d, 0, d, 0, -d, 0, d,\dots$$

Collecting all of the equations together, we get:

$$a\cdot\displaystyle\frac{(-1)^n+1}{2} + b\cdot\displaystyle\frac{(-1)^{n+1}+1}{2} + c \cdot \cos{\left((e^{2 \pi i/4})^n \right)} + d \cdot \cos{\left((e^{2 \pi i/4})^{n+1} \right)}$$ $$= a+c, b-d, a-c, b+d,\quad a+c, b-d, a-c, b+d,\dots$$

...So we have to solve:

$$a+c = 1$$ $$b-d = 3$$ $$a-c = 5$$ $$b+d = 7$$

This can be solved with linear algebra, for instance. We end up with:

$$a = 3$$ $$b = 5$$ $$c = -2$$ $$d = 2$$

...So our final equation is:

$$3\cdot\displaystyle\frac{(-1)^n+1}{2} + 5\cdot\displaystyle\frac{(-1)^{n+1}+1}{2} - 2 \cdot \cos{\left((e^{2 \pi i/4})^n \right)} + 2 \cdot \cos{\left((e^{2 \pi i/4})^{n+1} \right)}$$ $$= 1,3,5,7,1,3,5,7,\dots$$

This formula has several advantages over taking the modulus. For instance, you can integrate it, since it's continuous. You can also take sums of it without much trouble. I hope this was intriguing!

-

Do you want the $\;n-$th term of the sequence $\;\{a_n\}=\{1,3,5,7,1,3,5,7,1\ldots\}\;$ , so

$$a_n=\begin{cases}1&,\;\;n=1\pmod 4\\3&,\;\;n=2\pmod 4\\5&,\;\;n=3\pmod 4\\7&,\;\;n=0\pmod 4\end{cases}$$

-

HINT: You probably won’t find a nice formula for the $n$-th term using familiar functions, but you can always use a multipart formula:

$$x_n=\begin{cases} 1,&\text{if }n=4k+1\text{ for some integer }k\\ 3,&\text{if }\ldots\\ 5,&\text{if }\ldots\\ 7,&\text{if }\ldots\\ \end{cases}$$

Can you fill in the other three cases?

Note that I’m assuming that you’re indexing the sequence as $\langle x_1,x_2,x_3,\ldots\rangle$; if you’re starting with $x_0$, as I normally would, the first condition would be $$\text{if }n=4k\text{ for some integer }k\;.$$

-
I believe that we can get a formula with the familiar functions; see my answer. –  Matt Groff Sep 19 '13 at 15:32
@Matt: I know that we can, and I debated doing it; but as I said, most students probably won’t, unless they’ve seen the trick before. –  Brian M. Scott Sep 19 '13 at 18:11
I believe I ended up doing a bad job explaining my answer anyways. It doesn't fit very easily into a short, concise answer. Not to conversate, but sorry if I came across as haughty. –  Matt Groff Sep 20 '13 at 2:22
@Matt: No problem; my comment could have meant that I didn't think that there was such a formula. –  Brian M. Scott Sep 20 '13 at 3:45