So the above statement is a question from a course on Theory of Computation. I have already proven it using the pumping lemma, but am looking for proofs using the Myhill-Nerode theorem, or more specifically, it's corollary, which states that a language, $L$, has a finite number of equivalence classes under the relation $\cong_L$ (indistinguishability under L), if and only if it is regular.
My idea for this was to take two strings, say $x$ and $y$, and concatenate a string, $w$ to both of these. Then, if the two strings are, indeed indistinguishable under $L$, then $|x| + |w|$ and $|y| + |w|$ should either be simultaneously prime, or simultaneously composite for all choices of $w$ (i.e. if $|x| + |w| \text{ is prime } \Leftrightarrow |y| + |w| \text{ is prime }$ . My goal here is to prove that if this is true, then $|x| = |y|$, and as no two strings in the language have the same length, $x = y$. I think the key here is that both $|x|$ and $|y|$ are prime.
I am currently stuck proving simultaneous prime/composite nature of the above two values, and need some help. Maybe a number theoretic solution could apply here?
Given two prime numbers $p\leq q$, assume the two sets $$ M = \{m\mid m + p\text{ is prime}\}\\ N = \{n\mid n + q\text{ is prime}\} $$ are equal. In particular, because $q = p + (q-p)$ is prime, $q-p\in M$. So $q-p\in N$, impying that $q + (q-p) = 2q-p$ is prime. But $2q-p = p + 2(q-p)$ so $2(q-p)\in M$, which means $2(q-p)\in N$.
Continuing this argument ad infinitum, we see that $k(q-p)\in M, N$ for any natural number $k$. But $k = p$ yields $p + p(q-p) = p(1 + q - p)$ prime. And this cannot happen unless $1+q-p = 1$, which is to say $p = q$.