# Create a grammer for [duplicate]

create a grammer for {a^nb^m, n>0, m=2^n+1}

itS unrestricted grammer. I tried to but couldnt understand. if you know the answer please breif it. coz i m new in this subject

## marked as duplicate by D.W.♦Sep 14 '15 at 23:04

• Hello! We discourage posts that simply state a problem out of context, and expect the community to solve it. Assuming you tried to solve it yourself and got stuck, it may be helpful if you wrote your thoughts and what you could not figure out. It will definitely draw more answers to your post. Until then, the question will be voted to be closed / downvoted. You may also want to check out our reference questions, or use the search engine of this site to find similar questions that were already answered. – D.W. Sep 14 '15 at 23:05
• Anyway, one approach is to create a Turing machine that recognizes that language, then convert it to a grammar using the answers in the duplicate. Since you haven't provided us any context, you haven't shown us what you have tried and what you are stuck on or confused by, and you haven't asked a question (but just asked us to solve your exercise for you -- which helps neither you nor future visitors), I've put this on hold as a duplicate of that question. – D.W. Sep 14 '15 at 23:05

Hint 2. try some scanning process to generate $\{b^m|m=2^n+1\}$, then generate $\{a^n\}$ USING THE SAME TECHNIQUE, and try to merge them.
2. Using a state variable to scan from left to right and processing, then back. $$Acc \to aAcc \to abbAc \to abbbbA \to \underline{abbbB} \to Aaccc$$ $$Aaccc\to aaAccc \to aabbAcc \to aabbbbAc \to aabbbbbbA \to \underline{aabbbbbB} \to Aaaccccc$$
3. To make up for the direction change, and extra processing at both ends, using delimiters $\#$. Now start symbol $S\to\#Acc\#$