# Is $L = \{a^{p^2}\mid p\text{ is a prime}\}$ regular?

By pumping lemma, we choose the word $$w=a^{p^2}$$ that the decomposing is $$[a^sa^ta^{p-s-t}]^p$$ such that $$u=a^s,v^i=a^t,x=a^{p-s-t}$$

$$[a^sa^{it}a^{p-s-t}]^p=[a^{p+it-t}]^p$$

We choose i=p+1,we get $$[a^{(1+t)p}]^p$$ $$=a^{(1+t)p^{2}}$$

we see that the power $$(1+t)p^{2}$$ has 4 dividers thus doesn't belong to the Language L where the power of a is $$p^2$$ with 3 dividers.

• Hi! Note that your answer fails to actually mention whether L is regular or not.
– Stef
Dec 14, 2022 at 13:15
• You decomposed the string into $3p$ separate parts instead of just $3$ parts, if I understand correctly? e.g. if p=3 you have $a^sa^ta^{p-s-t}a^sa^ta^{p-s-t}a^sa^ta^{p-s-t}$ Dec 14, 2022 at 15:24
• We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher.
– D.W.
Dec 14, 2022 at 20:16

It's not more difficult than the statement you have, and it proves immediately that languages like $$a^{n^2}$$, $$a^{n!}$$ etc. are all non-regular.