General formula for nth element of the sequence 0, 1, 0, 1, ...
The sequence is $f = 0, 1, 0, 1, \ldots$
I want to find a general formula for the $n$th element. The sequence starts at $n = 0$ (the $0$ here is not the first element $0$ but rather denotes the $0$th position).
One easy and obvious solution is: $n$th $f = n \bmod 2$. This works because even positions have $0$ and odd positions have $1$.
However, this question is part of a homework and modulus has not been discussed (or part of the syllabus or even a prerequisite). And so I am hesitant to use it.
Is there another way to solve this problem using only basic arithmetic operations (one that a beginning high schooler knows of)?
$a_n=(1/2)(1+(-1)^{n+1})$, $n=0,1,2,.....$
The expression for the $n$th element of that sequence $f$ should take account of the products of $(-1)$.
As every number $n$ that appears in your sequence is just $$n = \frac{1}{2} + k,$$ where $$k = \pm\frac{1}{2},$$ then the general expression for the $n$th term $f_n$ would be the sum of the term $k$ to the $n$th: $$f_n = \frac{1}{2} + (-1)^n \left(\frac{1}{2}\right).$$
Considering that your sequence starts with the value $0$ in the first term. $(-1)^1 = -1, (-1)^2 = 1$, and so on.
Consider whether you can adjust the sequences from either of:
- $(-1)^n$
- $\cos(\pi n)$
to get what you are looking for, for example by adding a constant and/or multiplying by a constant
Have you learned about exponents yet, including the special cases $x^0$ and $x^1$? Here's a slightly more complicated definition using those exponents: $f(0) = 0$, $f(1) = 1$ (that's what software developers would call "initialization") then $$f(n) = f(n - 2)^{f(n - 1)}$$ for $n > 1$.
You could also do $f(n) = f(n - 2)$, though you could come across a smart-aleck with that one.