Background: I've recently watched a video by Michael Penn (link) where he shows how to solve the following integral:
$$ \int_0^{\frac 12} \prod_{n=1}^\infty \left(1+x^{2^n}\right) dx.$$
This integral can be solved easily (once you know the trick): you notice that $\prod_{n=0}^\infty \left(1+x^{2^n}\right) = 1+x+x^2 + x^3 +\cdots = \frac{1}{1-x}$, and finally you have $\int_0^{\frac 12} \frac{1}{(1-x)(1+x)} dx$ to solve.
In his thumbnail, however, he wrote this integral instead (notice that the sign inside the parenthesis changes): $$ \int_0^{\frac 12} \prod_{n=1}^\infty \left(1-x^{2^n}\right) dx.$$
I tried to solve this second one, and my attempt was to study how $P_N := \prod_{n=0}^N \left(1-x^{2^n}\right)$ behaves. My goal was to find a nice simplification, like the $\frac 1 {1-x}$ found previously. Here I got stuck.
My attempts/observations:
$P_N$ can be written in the form $P_N = \sum_{n=0}^{2^N} s_n x^n$, with $\{s_n\}$ being a sequence that tells you whether the $n$-th term is positive or negative. When $N\to\infty$, the series absolutely converges for $|x| < 1$. Furthermore, if $x = 1$ or $x = -1$, $P_N = 1 \quad \forall N \in \mathbb N$. On the contrary, if $ |x| > 1$, the terms $1-x^{2^n} \to -\infty$, so the product would oscillate (and diverge). Therefore, as $N\to \infty$, $P_N$ converges iff $|x| \le 1$.
When $P_\infty$ converges, $0 \le P_\infty \le 1$.
I tried to understand what pattern the signs follow. The whole product could be rewritten as the sequence $a_{N+1} = a_N\left(1 - x^{2^N}\right) = a_N - a_N x^{2^N}$ with $a_0 = 1$. Here I built up some intuition to write the list of signs, so you take all the previous terms you have, flip the signs, append them to the end, and repeat. So, you get $ \{+\} \to \{+, -\} \to \{+, -, -, +\} \to \{+, -, -, +, -, +, +, -\} \to \cdots$. I couldn't find a way to find a formula that tells me if the $n$-th sign is a positive or a negative one. Also, I tried to check for any periodicity but I couldn't find any.
Main question: as that product converges for $|x| \le 1$ between $0$ and $1$, there should be a function $f: [-1,1] \to [0,1]$ that takes $x$ and gives back the limit value. Is it possible to write down $f$ explicitly? In other words, what is the equivalent of $\prod_{n=0}^\infty \left(1+x^{2^n}\right)=\frac{1}{1-x}$ for $\prod_{n=0}^\infty \left(1+x^{2^n}\right)$?
Related questions:
- Is it possible to write a closed-form of $\{s_n\}$? That is, can you find a formula by which you get back the sign of the $n$-th element in the $\sum s_n x^n$ form?
- Are there other (symbolic) strategies that can be used to solve the second integral?
Update: I've confirmed experimentally that $$ s_n = \begin{cases} 1, & \text{if } n \text{ in base 2 has even number of 1s}\\ -1, & \text{if } n \text{ in base 2 has odd number of 1s}\end{cases} $$ holds for all $n < 2^{21}$ (thanks to Robert Israel) and I think it works also for all natural numbers. I don't know how to prove it though. Also, I don't know if and how this could be useful to answer the main question
Update 2: In this answer, Robert Israel proves that, given $ \prod_{n=1}^\infty \left(1-x^{2^n}\right) = \sum_{k=0}^\infty b_k x^k $: $$ b_k = \begin{cases} 0,& \text{if } k \text{ is odd}\\ 1,& \text{if } k \text{ is even and } k \text{ in base 2 has an even number of 1s}\\ -1,& \text{if } k \text{ is even and } k \text{ in base 2 has an odd number of 1s}\\ \end{cases} .$$
So now it's easy to justify the claim in last update: $$ \begin{aligned}\prod_{n = 0}^\infty \left(1-x^{2^n}\right) &= (1-x)\prod_{n = 1}^\infty \left(1-x^{2^n}\right) =\\&= (1-x)\sum_{k=0}^\infty b_{2k} x^{2k} =\\&= \sum_{k=0}^\infty b_{2k} x^{2k} - \sum_{k=0}^\infty b_{2k} x^{2k+1} =\\&= \sum_{n=0}^\infty s_n x^n.\end{aligned} $$
If $n$ is even, $ s_n = b_n $. If $n = 2k + 1$ is odd, in base 2 $n$ has one $1$ more than $2k$ and $s_n = -b_{2k}$ (so if $2k$ has a odd number of 1s, $n$ has an even one, and viceversa). Putting these two cases together, you get the definition of $s_n$ given in the previous update.
Let $\prod_{n=1}^\infty (1-x^{2^n}) = \sum_{k=0}^\infty b_k x^k$.
Expanding out the left side, we have terms of the form $$\prod_{n \in S} (-x^{2^n}) = (-1)^{|S|} x^{\sum_{n \in S} 2^n} $$ for all finite subsets $S$ of the positive integers. For each even integer $k$ there is exactly one such term, where $S$ consists of those $n$ where the base-$2$ expansion of $k$ has a digit $1$. Thus the coefficient $b_k$ for even $k$ is $-1$ if this base-$2$ expansion has an odd number of $1$'s, and $1$ if it has an even number of $1$'s, while if $k$ is odd there is no such term and the coefficient is $0$.