I want to practice finding grammars for given languages. Unfortunately after solving some easy examples I found out that I completely don't know how to approach these more ambitious. For example when the task is to find grammar for $\left\{ a^i b^{i+2j}c^j: i,j\ge 0 \right\}$ it is very simple and after one minute I have a solution: $$S\rightarrow XY \\ X\rightarrow aXb \ | \ \varepsilon \\ Y\rightarrow bbYc \ | \ \varepsilon$$ However it has been 5 hours since I tried these examples:
a) $\left\{ a^{n^2} : n\ge 1 \right\}$
b) $\left\{ a^{2^n} : n\ge 1 \right\}$
c) $\left\{ a^n b^n c^n : n\ge 1 \right\}$
d) $\left\{ x\in \left\{ a,b,c \right\}^* : count_a(x) = count_b(x) = count_c(x) \right\}$
where $\left\{ a,b,c \right\}^*$ denotes set of all words consisting of letters $a,b,c$, and $count_a(x)$ is the number of occurrences $a$ in word $x$.
And I still can't manage to find grammars for above sets. Can anyone help?