I know that this question has already been answered but the proofs provided do not seem intuitive to me and I propose one using Wilson's theorem.
Say $L$ is regular and its pumping length is $p \geq 1$.
Choose $q$ to be the first prime after $p$ and w = $a^q$ can be rewritten as:
$$a^la^wa^{q-w-l}$$
According to the Pumping Lemma: $$ \ a^la^{wi}a^{q-w-l} = a^{q+w(i-1)} \ \in L \ \forall \ i \geq0 $$
Choosing $i$ to be $(q-1)! +2$ then $a^{q+w[(q-1)! + 1]}$ should be in $L$.
However we know that:
- $q$ divides $q$
- $q$ divides $(q-1)! + 1$ using Wilson's theorem
- $q$ divides $w[(q-1)! + 1]$ due to $2.$
- $q$ divides $q+w[(q-1)! + 1]$ due to $1.$ and $2.$
Therefore $q+w[(q-1)! + 1]$ is not a prime and $a^{q+w[(q-1)! + 1]}$ is not in $L$.
Is my proof correct or am I missing something?