Prove $10^{10^{10^n}} + 10^{10^n} + 10^{n} - 1$ is never prime

I was working on the following problem:

Prove $10^{10^{10^n}} + 10^{10^n} + 10^{n} - 1$ is never prime for any $n \in \mathbb{N}$

With some help I was able to figure out an answer to this, however I would have found it difficult to come up with independently. Is there any intuition for how to solve this, in particular how to figure out the factor in terms of $n$ that will divide this number.


I was also wondering if this generalizes in some interesting way. In particular,

For what values of $L \in \mathbb{N}$ is: $$ \sum_{k=0}^{L} \left ( 10^{10^{\dots \text{k times} \ ^{{10^n}}}} \right ) - 1 $$ never prime for any $n \in \mathbb{N}$.

Also sorry for the notation in this, I wasn't quite sure how to represent it best.


Solution 1:

One thing to do is think of an $m$ with respect to which the sum is $0$ mod $m$. One way to do this is notice that the exponents $10^n$ and $10^{10^n}$ will be even, so if $n$ is odd and $10\equiv -1$ mod $m$ (which means $m=11$) then the sum will be $1+1+(-1)-1\equiv 0$. What happens if $n$ is even?

Write $n=2^rk$ where $k$ is odd. Pick $m=10^{2^r}+1$, so $10^{2^r}\equiv -1$ mod $m$, hence also $10^n\equiv-1$ mod $m$. Since the exponents $10^{10^n}$ and $10^n$ are both divisible by $2^{r+1}$, we may compute

$$ 10^{10^{10^n}}+10^{10^n}+10^n-1 ~~\equiv~~ 1+1+(-1)-1~~\equiv~~ 0\mod m.$$