Problems computing the DFT of finite length sequence
Assuming $N$ even :
$$
\begin{align}
X[k] &amp;= \sum_{n=0}^{N-1} x[n] ~ W_N^{kn} ~~~,~~~k=0,1,...,N-1\\ \\
&amp;= \sum_{n=0}^{N/2-1} 1 ~ W_N^{k ~2n}  \\ \\
&amp;= \sum_{n=0}^{N/2-1} e^{-j 4\pi kn/N} \\ \\
&amp; = \frac{ 1 - e^{-j \frac{4\pi k}{N}N/2 }}{ 1 - e^{-j 4\pi k/N}} \\ \\ 
&amp; = \frac{ 1 - e^{-j 2\pi k}}{ 1 - e^{-j 4\pi k/N}}~~~,~~~k=0,1,...,N-1\\ 
\end{align}
$$
The result equals:
$$
X[k] = \begin{cases}{ ~~~ N/2 ~~~ ,~~~ k = 0, N/2 \\ ~~~~~~ 0 ~~~~~ ~ ,~ ~\text{otherwise} } \end{cases}
$$