What is $\lim_{x\to1^{-}} (1-x)\left(\sum_{i=0}^{\infty} x^{i^2}\right)^{2}$?

I believe to have already solved this question, but I am not managing to find the duplicate, so I will re-sketch my argument. By squaring $f(x)$ we get $$ f(x)^2 = \sum_{n\geq 0} \widetilde{r}_2(n) x^n $$ where $$ r_n(n)=\left|\{(a,b)\in\mathbb{Z}^2: a^2+b^2=n\}\right|,\qquad \widetilde{r}_n(n)=\left|\{(a,b)\in\mathbb{N}^2: a^2+b^2=n\}\right|$$ and by Gauss circle problem $$ \sum_{n=0}^{N}r_2(n) = \pi N + O(\sqrt{N}) $$ (the error term can be improved into $O(N^{1/3})$ by Voronoi summation formula, but the previous elementary bound is sufficient for our purposes), such that $$ R(N) = \sum_{n=0}^{N}\widetilde{r}_2(n) = \frac{\pi}{4}N +O(\sqrt{N}) $$ and $$ \frac{f(x)^2}{1-x} = \sum_{N\geq 0} R(N) x^N = \frac{\frac{\pi}{4}x}{(1-x)^2}+O\left(\frac{1}{(1-x)^{3/2}}\right)$$ as $x\to 1^-$. Multiplying both sides by $(1-x)^2$ and considering the limit as $x\to 1^-$ we get: $$ \lim_{x\to 1^-}(1-x)f(x)^2 = \color{red}{\frac{\pi}{4}}. $$


An alternative approach comes from considering the convolution with an approximate identity.
In general $$ \left(\sum_{n\geq 0} x^{n^k}\right)^k \sim \frac{\Gamma\left(1+\frac{1}{k}\right)^k}{1-x} $$ as $x\to 1^-$. Oh, now I have found the answer I was mentioning before, containing a (sketch of) proof of the last statement, too.


Let me check my luck with that ...

$$\lim_{x\to 1^{-}} (1-x)f^2(x)=\lim_{a\to -1} \lim_{x\to 1^{-}} (1-x)\left(\int_0^{\infty} x^{-a t^2}\textrm{d}t\right)^2=\lim_{a\to -1} \lim_{x\to 1^{-}}\frac{\pi}{4a}\frac{1-x}{\log(x)}=\frac{\pi}{4}.$$

The problem can be extended in more ways. One example is

$$\lim_{x\to 1^{-}} (1-x)g^3(x)=\lim_{x\to 1^{-}} (1-x)\left(\sum_{i=0}^{\infty} x^{i^3}\right)^3=\frac{1}{27}\left(\Gamma\left(\frac{1}{3}\right)\right)^3,$$ where the method described above works perfectly.

So, in the generalized form,

$$\lim_{x\to 1^{-}} (1-x)\left(\sum_{i=0}^{\infty} x^{i^n}\right)^n=\frac{1}{n^n}\left(\Gamma\left(\frac{1}{n}\right)\right)^n.$$

When letting to $n \to \infty$, $$\lim_{n\to\infty} \lim_{x\to 1^{-}} (1-x)\left(\sum_{i=0}^{\infty} x^{i^n}\right)^n=\frac{1}{e^{\gamma}}.$$


Since $x^{t^k}=e^{-\log(1/x)\,t^k}$, we have for $x\lt1$, $$ x^{(n+1)^k} \le\int_n^{n+1}e^{-\log(1/x)\,t^k}\,\mathrm{d}t \le x^{n^k}\tag1 $$ Summing in $n$ yields $$ \sum_{n=1}^\infty x^{n^k}\le\int_0^\infty e^{-\log(1/x)\,t^k}\,\mathrm{d}t\le\sum_{n=0}^\infty x^{n^k}\tag2 $$ multiplying by $\log(1/x)^{1/k}$ gives $$ \int_0^\infty e^{-t^k}\mathrm{d}t\le\log(1/x)^{1/k}\sum_{n=0}^\infty x^{n^k}\le\log(1/x)^{1/k}+\int_0^\infty e^{-t^k}\mathrm{d}t\tag3 $$ Since $$ \lim_{x\to1}\frac{\log(1/x)}{1-x}=1\tag4 $$ the Squeeze Theorem and $(3)$ say that $$ \begin{align} \lim_{x\to1^-}(1-x)^{1/k}\sum_{n=0}^\infty x^{n^k} &=\lim_{x\to1^-}\log(1/x)^{1/k}\sum_{n=0}^\infty x^{n^k}\\ &=\int_0^\infty e^{-t^k}\mathrm{d}t\\[3pt] &=\frac1k\int_0^\infty e^{-t}t^{\frac1k-1}\mathrm{d}t\\[3pt] &=\frac1k\Gamma\!\left(\frac1k\right)\\[6pt] &=\Gamma\!\left(1+\frac1k\right)\tag5 \end{align} $$ That is, $$ \lim_{x\to1^-}(1-x)\,\left(\sum_{n=0}^\infty x^{n^k}\right)^k=\Gamma\left(1+\frac1k\right)^k\tag6 $$


For $k=2$, $(6)$ yields $$ \begin{align} \lim_{x\to1^-}(1-x)\,\left(\sum_{n=0}^\infty x^{n^2}\right)^2 &=\Gamma\left(\frac32\right)^2\\ &=\frac\pi4\tag7 \end{align} $$