Regular Expressions & Languages

Answer & solution
Official answer: C
1. Method and setup. Finite-state memory can retain a count modulo a fixed constant, but cannot in general remember arbitrary equal block lengths, primality of unbounded lengths, or an arbitrary string for exact copying. For C, use states representing residues 0,1,2 of the b-count; a leaves the state unchanged and b advances it cyclically.
2. Work through the result and its assumptions. A DFA can count b symbols modulo 3 while ignoring a, accepting the residue 1 class; if natural k excludes 0, a finite initial-count adjustment still makes it regular. The equal-count language is nonregular by pumping; unary prime lengths are not ultimately periodic. The copy language is nonregular: intersection with 0*1*0*1* yields 0i1j0i1j, whose equal nonadjacent blocks defeat pumping on 0p1p0p1p. Thus only C.