Finding the largest prime in sequence 10101... If you consider the (decimal) numbers 10, 101, 1010, 10101... where the 1 and 0 alternate, what is the largest prime number in the sequence?
Thanks in advance for your help, I appreciate it.
 A: The only prime in this sequence is $101$.
As @EuYu pointed out, for even n, $k_{2n} = k_{n}(10^{2n}+1)$ is even. This equality can be easily shown by considering multiplication by $10^n$ as appending $n$ zeros to the end of the number in base 10, and noting that $k_{2n}$ has $2n$ digits.
$k_{2 n + 1}$ is divisible by a string of $(2n+1)$ $1$'s. Explicitly, $$\left(\sum_{i=0}^{2n+1} 10^i \right)*\left(1+ \sum_{i=0}^{n} 10^{2 i}*90\right ) = k_{2 n + 1}$$
Algebraically you can bash this out (or throw at Wolfram), but there's a good pen-n-paper way to see this.
Look at $909091*1111111$.
$90*1111111=99999990$.
Adding $1111111$ to this will "overflow" the number to $101111101$, which is of the form $10[1...1]01$
Now add that to $9999999000=9000*1111111$.
Look at the digit-wise sums from right to left: last 3 unchanged because $10^3 | 9000$, then 10s until the first 0 in $101111101$.
Considering the carried "1" at each step, the sum is $1010[1...1]0101$.
Proceed inductively, result = $1010101010101$.
A: Clearly the number cannot end in $0$, so we consider integers of the form
$$k_n=1010101\cdots 01,$$
where $k_n$ is of length $2n-1$. Note that every such integer is of the form
$$k_n = \frac{10^{2n}-1}{99} = \frac{(10^{n}-1)(10^n + 1)}{99}.$$
If $n=1$, then $k_1=1$. If $n=2$, then $k_2 = 101$, which is prime. If $n>2$ and $n$ is even, then
$$k_n = k_{n/2}(10^n+1),$$
so that $k_n$ is composite. Finally, if $n>2$ is odd, then $11\mid (10^n+1)$ and $9\mid (10^n - 1)$ so that again $k_n$ is composite. It follows that in this sequence, only $k_2 = 101$ is prime.
