Let $p$ and $q$ be integers.
Let $f(n)$ be A007814, the exponent of the highest power of $2$ dividing $n$, a.k.a. the binary carry sequence, the ruler sequence, or the $2$-adic valuation of $n$.
Then we have an integer sequence given by \begin{align} a(0)=a(1)&=1\\ a(2n)& = pa(n)+qa(2n-2^{f(n)})\\ a(2n+1) &= a(n-2^{f(n)}) \end{align}
Let $$s(n) = \sum\limits_{k=2^{n-1}}^{2^{n}-1}a(k), s(0)=1$$ then I conjecture that $$\sum\limits_{k=0}^{\infty}s(k)x^k=\frac{1}{1-x}+\sum\limits_{k=2}^{\infty}\left(\prod\limits_{j=2}^{k}(q^{j-1}+p\sum\limits_{r=0}^{j-2}q^r)\right)\frac{x^{2(k-1)}\left(1-(-1+q^{k-1}+p\sum\limits_{s=0}^{k-2}q^s)x\right)}{(1-x)\prod\limits_{i=2}^{k}\left(1-(q^{i-1}+p\sum\limits_{t=0}^{i-2}q^t)x\right)^2}$$ There also exist finite variant: $$\sum\limits_{k=0}^{n}s(k)x^k=\frac{1}{1-x}+\sum\limits_{k=2}^{\left\lfloor\frac{n}{2}\right\rfloor+1}\left(\prod\limits_{j=2}^{k}(q^{j-1}+p\sum\limits_{r=0}^{j-2}q^r)\right)\frac{x^{2(k-1)}\left(1-(-1+q^{k-1}+p\sum\limits_{s=0}^{k-2}q^s)x\right)}{(1-x)\prod\limits_{i=2}^{k}\left(1-(q^{i-1}+p\sum\limits_{t=0}^{i-2}q^t)x\right)^2}$$
Is there a way to prove it?