<s>[INST] Number Theory: Which numbers 101010...0101 are prime I have this problem assigned for homework and I'm having some trouble with it. I'm in elementary number theory.
Set $M(k)=100^{k-1}+\dotsc +100+1$. Note that $M(k)$ has exactly $k$ ones.
For which $k$ is $M(k)$ a prime?
Hint: Set $R(k)=111\cdots 1$ with exactly $k$ ones and observe that $11\cdot M(k)=R(2k)=R(k)\cdot (10^k +1)$.
Thanks!
 [/INST] Big Hints:
If $n$ is odd, then $10^n\equiv(-1)^n\equiv-1\pmod{11}$. Therefore, $11\mid10^n+1$. Thus,
$$
\begin{align}
\sum_{k=0}^{n-1}100^k
&=\frac{100^n-1}{99}\\
&=\frac{10^n-1}{9}\frac{10^n+1}{11}
\end{align}
$$

If $n$ is even, then $n=2m$. Therefore,
$$
\begin{align}
\sum_{k=0}^{n-1}100^k
&=\sum_{k=0}^{2m-1}100^k\\
&=\sum_{k=0}^{m-1}100^{2k}(100+1)\\
&=101\sum_{k=0}^{m-1}100^{2k}\\
\end{align}
$$
Or we can start as we did when $n$ was odd,
$$
\begin{align}
\sum_{k=0}^{n-1}100^k
&=\frac{100^n-1}{99}\\
&=\frac{10^n-1}{99}(10^n+1)\\
&=\frac{100^m-1}{99}(10^n+1)
\end{align}
$$
</s>