TITLE: General formula for nth element of the sequence 0, 1, 0, 1, ...
QUESTION [15 upvotes]: 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)?

REPLY [6 votes]: First, some notes:

If you were to explain the functions you use (same goes for modulus), maybe your homework would get accepted anyway.
$\lceil{x}\rceil$ denotes the ceiling function which takes as input the real number $x$ and gives as output the least integer greater than or equal to $x$, i.e. $\lceil{5.3}\rceil=6$.
$\lfloor{x}\rfloor$ denotes the floor function which takes as input the real number $x$ and gives as output the greatest integer less than or equal to $x$, i.e. $\lfloor{5.3}\rfloor=5$.
When $x$ is an integer, then $\lceil{x}\rceil=\lfloor{x}\rfloor=x$.

With this mind:
Your sequence
$$\{f_n\}=0,1,0,1,0,1,\dots$$
can be generated by the function
$$f_n=\left\lceil\frac{n}{2}\right\rceil-\left\lfloor\frac{n}{2}\right\rfloor,\;\ n\in\mathbb{Z}^{\ge0}$$
For each even positive integer $n$ (including $0$), the ceiling and floor function evaluate to equal values, canceling each other out; $f_n=0$.
For each odd positive integer $n$, the ceiling and floor function evaluate to values differing by $1$; $f_n=1$.