Prove language is regular
The language $L$ is not regular, but $L_2$ is. In fact $L_2 = \{a,b\}^*$.
Indeed if $w \in L_2$, then by definition, $w$ is suffix of a word of $\{a,b\}^*$ and thus $w \in \{a,b\}^*$. Thus $L_2 \subseteq \{a,b\}^*$. To prove the opposite inclusion, consider a word $w \in \{a,b\}^*$. Let $p$ be a prime such that $p \geqslant |w|$ and let $u = a^{p-|w|}w$. By construction, $|u| = p$,
$u \in \{a,b\}^*$ and $w$ is a suffix of $u$, and thus $w \in L_2$.