While practicing from a book I found a product in the form $$(x^{a^1}+1)\cdot(x^{a^2}+1)\cdot(x^{a^3}+1)\cdot(x^{a^4}+1)$$ and was immediately curious if I could a formula to solve the product for $n$ terms, that is, a single formula for the product $$(x^{a^1}+1)\cdot(x^{a^2}+1)\cdot(x^{a^3}+1)(x^{a^4}+1)\ldots(x^{a^n}+1)$$
After multiplying the first four terms I could see a pattern develop in the form $x^{a+a^2+a^3+a^4...a^n}+x^a+x^{a^2}+x^{a^3}+x^{a^4}...+x^{a^n}+x^{a+a^2+a^3}+x^{a+a^2+a^4}+x^{a^2+a^3+a^4}+x^{a+a^3+a^4} ...+x^{a^{n-2}+a^{n-1}+a^n} + x^{a+a^2} +x^{a+a^3}+x^{a+a^4}+x^{a^2+a^3}+x^{a^2+a^4}+x^{a^3+a^4}...x^{a^{n-1}+n}...+x^{a+a^2+a^3+....a^{n-2}+a^{n-1}+1}$
Now I can easily find the summation of powers in the first term but cant find a formula for the summation of $x^a+x^{a^2}+x^{a^3}+x^{a^4}...+x^{a^n}$ and also can't figure out how to account for the other terms.