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}$


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.

Is my answer correct?

  • 1
    $\begingroup$ Hi! Note that your answer fails to actually mention whether L is regular or not. $\endgroup$
    – Stef
    Dec 14, 2022 at 13:15
  • $\begingroup$ 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}$ $\endgroup$
    – user253751
    Dec 14, 2022 at 15:24
  • $\begingroup$ 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. $\endgroup$
    – D.W.
    Dec 14, 2022 at 20:16

1 Answer 1


Instead of looking at primes I would prove this:

The language { a^k: k is an element of S } where S is an infinite set of non-negative integers with arbitrary large gaps between elements is not regular.

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.