I assumed this would be easy to prove but it turned out to be quite hard since the go to methods don't work on this problem.
Once we fix any $a\gt 1$, we need an algorithm to produce a prime $p$ that makes $\frac{a^p-1}{a-1}$ composite and $a \not \equiv 1 \pmod p$. One method to prove compositeness is to consider it as a polynomial and find polynomial factors. However, $\frac{x^p-1}{x-1}=x^{p-1}+x^{p-2}+\cdots +x+1$, being the cyclotomic polynomial $\Phi_{p}(x)$, is irreducible and this leads to a dead end. (The case when $a$ is a perfect power leads to a reducible polynomial resulting in an easy proof for that case, but this does not work for any other $a$).
Another method is to check if a prime $q$ can divide $\frac{a^p-1}{a-1}$ for two different values of $p$. Suppose that $q \not = p$ divides$ \frac{a^{p}-1}{a-1}$, then $a^p \equiv 1 \pmod q$, implying that the order of $a$ mod $q$ is either $1$ or $p$. The order cannot be $1$ because if: $$ \begin{align} a & \equiv 1 \pmod q \\ \implies \frac{a^p-1}{a-1} = \sum_{i=0}^{p-1} a^i & \equiv \sum_{i=0}^{p-1} 1^i \pmod q \\ & \equiv p \not \equiv 0 \pmod q \end{align} $$
Therefore, the order of $a$ has to be $p$ and $a^x \equiv 1 \pmod q$ has a solution if and only if $x$ is a multiple of $p$. Obviously, no other prime is a multiple of $p$ and therefore $q$ divides only one $\frac{a^p-1}{a-1}$. When $q=p$, Fermat's little theorem, $a^p \equiv a \pmod p$, forces $a \equiv 1 \pmod p$ which is not allowed as per the question statement. Another dead end.
The funny thing is that once you check this for different values of $a$, it is easy to find a $p$ that satisfies the conditions and our required number seems to be composite for most $p$. For example, $p=11$ works for $a=2$ (Mersenne composite) and $p=5$ works for $a=3$. However, there doesn't seem to be a pattern that can be harnessed to extend this to all $a$. It is possible that I'm missing something obvious.
While researching online, I found out that these are precisely the repunit numbers with base $a$ and prime exponent, $R_p^{(a)}$. But I couldn't find a proof of my question anywhere.
EDIT: The same question can be asked for $\frac{a^p+1}{a+1}$ with the conditions now being $p$ an odd prime not dividing $a+1$. This is the cyclotomic polynomial $\Phi_{2p}(a)$ as opposed to $\Phi_{p}(a)$.
A weaker question would be to ask if for every $a>1$, there is a prime $p$ (satisfying the conditions) that gives a composite output to either $\Phi_{p}(a)$ or $\Phi_{2p}(a)$.
Following a proof idea @Derivative mentioned in a comment below, if $p$ is a Sophie Germain prime, $q=2p+1$ divides $\Phi_{p}(a)$ iff $\left( \frac{a}{q} \right)=1$ and $a \not \equiv 1 \pmod q$. Similarly, $q$ divides $\Phi_{2p}(a)$ iff $\left( \frac{a}{q} \right)=-1$ and $a \not \equiv -1 \pmod q$. Since $a \equiv 0, \pm 1$ for only finitely many primes and $\left (\frac{a}{q} \right) = \pm 1$, the (conjectured) existence of infinitely many Sophie Germain primes would prove our weaker result.
(This question actually came up naturally when I was trying to prove that for any fixed base $a$, there are infinitely many Fermat pseudoprimes to that base. I managed to prove that result using different methods, but I could not prove the result in the question).
Related.
– May 24 '21 at 10:44