1 Introduction

Let \(n\in {\mathbb {N}}\) and by \(s_2(n)\) denote the sum of (binary) digits function of n, i.e., if \(n=\sum _{k=0}^m \varepsilon _k 2^k\) with \(\varepsilon _k\in \{0,1\}\), is the unique expansion of n in base 2 then \(s_2(n)=\sum _{k=0}^m \varepsilon _k\). Next, let us define the Prouhet–Thue–Morse sequence (the PTM sequence for short) on the alphabet \(\{-1,+1\}\) as \(\mathbf{t}=(t_n)_{n\in {\mathbb {N}}}\), where \(t_n=(-1)^{s_2(n)}\). The sequence \(\mathbf{t}\) satisfies the following recurrence relations: \(t_0=1\) and

$$\begin{aligned} t_{2n}=t_n,\quad t_{2n+1}=-t_n \end{aligned}$$

for \(n\in {\mathbb {N}}\). The PTM sequence has many remarkable properties and found applications in combinatorics on words, analysis on manifolds, number theory and even physics [1]. One of the striking properties of the sequence \(\mathbf{t}\) is the simple shape of the generating function \(F(x)=\sum _{n=0}^{\infty } t_nx^n\in {\mathbb {Z}}[[x]]\). Indeed, from the recurrence relations we easily deduce the functional equation \(F(x)=(1-x)F(x^2)\) and in consequence the identity

$$\begin{aligned} F(x)=\prod _{n=0}^{\infty }\left( 1-x^{2^n}\right) . \end{aligned}$$

The sequence \(\mathbf{b}=(b_n)_{n\in {\mathbb {N}}}\) of coefficients of the related power series

$$\begin{aligned} \frac{1}{F(x)}=\prod _{n=0}^{\infty }\frac{1}{1-x^{2^n}}=\sum _{n=0}^{\infty } b_nx^n \end{aligned}$$

has also a strong combinatorial property. Indeed, the number \(b_n\) counts the number of representations of a non-negative integer n in the form

$$\begin{aligned} n=\sum _{i=0}^k \varepsilon _i 2^i, \end{aligned}$$

where \(k\in {\mathbb {N}}\) and \(\varepsilon _i\in {\mathbb {N}}\). One can easily prove that the sequence \(\mathbf{b}\) satisfies: \(b_0=b_1=1\) and

$$\begin{aligned} b_{2n}=b_{2n-1}+b_n,\quad b_{2n+1}=b_{2n} \end{aligned}$$

for \(n\ge 1\). The above sequence is called the sequence of the binary partition function. It was introduced by Euler and was studied by Churchhouse [5] (one can also consult the papers [6, 11, 13]).

From the discussion above we see that both \(\mathbf{t}\) and \(\mathbf{b}\) are sequences of coefficients of the power series expansion of \(F_{t}(x)=F(x)^t\) for \(t=1\) and \(t=-1\), respectively. It is quite natural to ask: what can be proved about sequences of coefficients of \(F_t(x)\) for other integer values of t? This question was our main motivation for writing this paper.

Let t be a variable and consider the sequence \(\mathbf{f}(t)=(f_n(t))_{n\in {\mathbb {N}}}\) of coefficients of the power series expansion of the function \(F_t(x)=F(x)^t\), i.e.,

$$\begin{aligned} F_t(x)=\prod _{n=0}^{\infty }\left( 1-x^{2^n}\right) ^t=\sum _{n=0}^{\infty } f_n(t)x^n. \end{aligned}$$

From the definition of \(\mathbf{f}(t)\) we see that for any given \(t\in {\mathbb {Z}}\) the sequence \(\mathbf{f}(t)\) is a sequence of integers. In the sequel we will study three closely related sequences. More precisely, in Sect. 2 we present some properties of the sequence \(\mathbf{f}(t)\) treated as a sequence of polynomials with rational coefficients. This is only a prelude to our research devoted to the values of the polynomials \(f_n\) at integer arguments. Section 3 is devoted to the study of the sequence

$$\begin{aligned} \mathbf{t}_m=(t_m(n))_{n\in {\mathbb {N}}}, \end{aligned}$$

where \(m\in {\mathbb {N}}_+\) is fixed and \(t_m(n)=f_n(m)\), i.e., \(t_m(n)\) is just the value of the polynomial \(f_n\) at \(t=m\). We prove several properties of the sequence \(t_m\) for certain values of m. In particular, in Theorem 3.3 we characterize the 2-adic valuation of the sequence \(\mathbf{t}_m\) for m being a power of 2 and \(m=3\). In the second part of this section we concentrate on the study of arithmetic properties of the sequence \(\mathbf{t}_m\) for \(m=2\) and \(m=3\). It is a simple observation that the sequence \(t_2\) is closely related to the values of the Stern polynomials at \(-2\). Moreover, we prove that the set of values of \(\mathbf{t}_2\) is just \({\mathbb {Z}}\backslash \{0\}\), which is the statement of Theorem 3.17 and that our sequence is log-concave, i.e., for each \(n\in {\mathbb {N}}_+\) we have \(t_2(n)^2>t_2(n-1)t_2(n+1)\) (Theorem 14). We also characterize the set of those \(n\in {\mathbb {N}}_+\) such that \(t_3(n)=0\) (Theorem 3.13). This allows us to prove that there are infinitely many values of n such that the polynomial \(f_n(t)/t\) is reducible (Corollary 3.14). Section 4 is devoted to the study of the sequence \(\mathbf{b}_m=(b_m(n))_{n\in {\mathbb {N}}}\), where \(m\in {\mathbb {N}}_+\) is fixed and \(b_m(n)=f_n(-m)\), i.e., \(b_m(n)\) is just the value of the polynomial \(f_n\) at \(t=-m\). The sequence \(b_m\) has a natural combinatorial interpretation. More precisely, the number \(b_m(n)\) counts the number of representations

$$\begin{aligned} n=\sum _{i=0}^k \varepsilon _i 2^i, \end{aligned}$$

where \(\varepsilon _i\in {\mathbb {N}}\) for \(i\in \{0,\dots ,k\}\) and each \(\varepsilon _i\) can have one among m colors. We present several results concerning this family of sequences. In particular, we study the 2-adic valuation of \(b_m(n)\) and give a precise expression for \(\nu _2(b_{2^k-1}(n))\), which allows us to deduce that the congruence \(b_{2^k-1}(n)\equiv 0\pmod {16}\) is impossible (Theorem 4.6). We also study more closely the family of polynomials \((h_{i,k,m}(x))\), with \(k\in {\mathbb {N}}\), \(0\le i<2^k\), \(m\in {\mathbb {N}}_+\), which appear in the computation of the expression for the generating function

$$\begin{aligned} H _{i,k}(x)=H_{i,k,m}(x)=\sum _{n=0}^{\infty } b_m\left( 2^kn+i\right) x^n=\frac{h_{i,k,m}(x)}{(1-x)^{km}}F_{-m}(x). \end{aligned}$$

The obtained results allow us to prove several congruences of various types for certain sequences \(\mathbf{b}_m\) (Theorems 4.10, 4.13). We also prove that for fixed \(k\in {\mathbb {N}}\) and \(0\le i<2^k\) the sequence \((h_{i,k,m}(x))_{m\in {\mathbb {N}}}\) is a linear recurrence sequence of order \(\le 2^k\) (Theorem 4.18).

In Sect. 5 we present some other results, questions and conjectures concerning sequences \(\mathbf{t}_m\) and \(\mathbf{b}_m\) for various values of \(m\in {\mathbb {N}}_+\). We hope that the problems stated in this section will stimulate further research in the area.

Finally, in the Appendix, written by A. Schinzel, the proof of Conjecture 3.18 from Sect. 3 is presented together with other material concerning non-vanishing of \(t_m(n)\).

2 Arithmetic properties of the coefficients of \(F_{t}(x)\)

We start with the computation of a recurrence relation satisfied by the sequence \(\mathbf{f}(t)=(f_{n}(t))_{n\in {\mathbb {N}}}\) and then introduce a related family of polynomials which will the main object of our study in this section. Let us put

$$\begin{aligned} F_{t}(x)=F(x)^{t}=\prod _{n=0}^{\infty }\left( 1-x^{2^{n}}\right) ^{t} =\sum _{n=0}^{\infty }f_{n}(t)x^{n}. \end{aligned}$$

During this paper we will treat all the power series formally, without considering their region of convergence. The function F(tx) satisfies the following functional equation \(F_{t}(x)=(1-x)^{t}F_{t}(x^2)\). This functional equation allows us to find a pair of recurrence relations satisfied by the the sequence \(\mathbf{f}(t)\).

We start with the following simple

Lemma 2.1

We have the following identity

$$\begin{aligned} {\text {log}}F(x)=\sum _{n=1}^{\infty }\frac{1-2^{\nu _{2}(n)+1}}{n}x^{n}, \end{aligned}$$
(1)

where \(\nu _{2}(n)\) is the 2-adic valuation of the integer n and

$$\begin{aligned} {\text {log}}(1+x)=\sum _{k=1}^{\infty }\frac{(-1)^{k-1}x^k}{k}. \end{aligned}$$

Proof

We use the expansion of the function \({\text {log}}(1-x)\) to obtain

$$\begin{aligned} {\text {log}}F(x)&=\sum _{n=0}^{\infty }{\text {log}}\left( 1-x^{2^n}\right) =-\sum _{n=0}^{\infty } \sum _{k=1}^{\infty }\frac{x^{2^nk}}{k}\\&=-\sum _{m=1}^{\infty }\sum _{l=0}^{\nu _2(m)}\frac{x^{2^l\cdot \frac{m}{2^l}}}{\frac{m}{2^l}}=-\sum _{m=1}^{\infty }\frac{(2^{\nu _2(m)+1}-1)}{m}x^m. \end{aligned}$$

\(\square \)

Remark 2.2

Using exactly the same type of reasoning, one can prove the following identity

$$\begin{aligned} \log \prod _{n=0}^{\infty }\left( 1-x^{k^{n}}\right) =\sum _{n=1}^{\infty } \frac{1-k^{\varphi _{k}(n)+1}}{n}x^{n}, \end{aligned}$$

where \(\varphi _{k}(n)\) is the highest power of k which divides n.

As an application of the above lemma we get the following recurrence relation for the sequence \(\mathbf{f}(t)\).

Lemma 2.3

Let \(F_{t}(x)=\sum _{n=0}^{\infty }f_{n}(t)x^{n}\). Then \(f_{0}(t)=1\) and for \(n\ge 1\) we have

$$\begin{aligned} f_{n}(t)=\frac{t}{n}\sum _{k=0}^{n-1}\left( 1-2^{\nu _{2}(n-k)+1}\right) f_{k}(t). \end{aligned}$$
(2)

Proof

We have the identity \(\log F_{t}(x)=t\log F(x)\). Taking derivative of both sides with respect to x and using the expansion (1), we get

$$\begin{aligned} \frac{F'_{t}(x)}{F_{t}(x)}=t\sum _{n=1}^{\infty }\left( 1-2^{\nu _{2}(n)+1}\right) x^{n-1}. \end{aligned}$$

Multiplying both sides by \(F_{t}(x)=\sum _{n=0}^{\infty }f_{n}(t)x^{n}\) and replacing n by \(n+1\) in the sum on the right side and in \(F'_{t}(x)\) we get

$$\begin{aligned} \sum _{n=0}^{\infty }(n+1)f_{n+1}(t)x^{n}&=t\left( \sum _{n=0}^{\infty } \left( 1-2^{\nu _{2}(n+1)+1}\right) x^{n}\right) \left( \sum _{n=0}^{\infty }f_{n}(t)x^{n}\right) \\&=t\sum _{n=0}^{\infty }\left( \sum _{k=0}^{n}\left( 1-2^{\nu _{2}(n-k+1)+1}\right) f_{k}(t)\right) x^{n}. \end{aligned}$$

Comparing now the coefficients on both sides of the above equality and replacing n by \(n-1\), we get the identity from the statement of our lemma. \(\square \)

Using other functional equations satisfied by \(F_{t}(x)\), we can deduce other recurrence relations.

Lemma 2.4

The sequence \(\mathbf{f}(t)\) satisfies the following recurrence relations:

  1. (1)

    \(f_{0}(t)=1\) and

    $$\begin{aligned} f_{n}(t)=-\sum _{k=0}^{n-1}{t+n-k-1\atopwithdelims ()n-k}f_{k}(t)+\chi _{2}(n)f_{\frac{n}{2}}(t), \end{aligned}$$

    where \(\chi _{2}(n)=(1+(-1)^{n})/2\);

  2. (2)

    \(f_{0}(t)=1\) and

    $$\begin{aligned} f_{n}(t)=\sum _{k=0}^{\left\lfloor \frac{n}{2}\right\rfloor }{n-2k-1-t\atopwithdelims ()n-2k} f_{k}(t), \end{aligned}$$

Proof

In order to prove the first recurrence relation for the sequence \(\mathbf{f}(t)\) we rewrite the functional equation for the function \(F_{t}(x)\) in the following form:

$$\begin{aligned} F_{t}(x^2)=\frac{1}{(1-x)^{t}}F_{t}(x)&=\left( \sum _{n=0}^{\infty }{t+n-1\atopwithdelims ()n} x^n\right) \left( \sum _{n=0}^{\infty }f_{n}(t)x^n\right) \\&=\sum _{n=0}^{\infty }\left( \sum _{k=0}^{n}{t+n-k-1\atopwithdelims ()n-k}f_{k}(t)\right) x^{n}. \end{aligned}$$

However,

$$\begin{aligned} F_{t}(x^2)=\sum _{n=0}^{\infty }f_{n}(t)x^{2n}=\sum _{n=0}^{\infty }\chi _{2} (n)f_{\frac{n}{2}}(t)x^{n}, \end{aligned}$$

and thus comparing the coefficients near \(x^{n}\) in the identity \(F_{t}(x^2)=(1-x)^{-t}F_{t}(x)\) and performing simple manipulations we get the first recurrence relation for the sequence \(\mathbf{f}(t)\).

In order to prove the second recurrence relation we compute

$$\begin{aligned} F_{t}(x)&=\left( \frac{1}{1-x}\right) ^{-t}\sum _{n=0}^{\infty }f_{n}(t)x^{2n}= \left( \sum _{n=0}^{\infty }{n-1-t\atopwithdelims ()n}x^n\right) \left( \sum _{n=0}^{\infty } \chi _{2}(n)f_{\frac{n}{2}}(t)x^{n}\right) \\&=\sum _{n=0}^{\infty }\left( \sum _{k=0}^{n}{n-k-1-t\atopwithdelims ()n-k}\chi _{2}(k) f_{\frac{k}{2}}(t)\right) x^{n}\\&=\sum _{n=0}^{\infty }\left( \sum _{k=0}^{\left\lfloor \frac{n}{2}\right\rfloor } {n-2k-1-t\atopwithdelims ()n-2k}f_{k}(t)\right) x^{n}. \end{aligned}$$

Comparing now the coefficients on both sides of the above identity, we get the second recurrence relation from the statement of our lemma.\(\square \)

Lemmas 2.3 and 2.4 show us that if we fix \(n\in {\mathbb {N}}\), then the expression \(f_{n}(t)\) is a polynomial with respect to t. The first terms of the sequence \((f_{n}(t))_{n\in {\mathbb {N}}}\) are:

$$\begin{aligned} f_{0}(t)&=1,\\ f_{1}(t)&=-t,\\ f_{2}(t)&=\frac{1}{2} (t-3) t,\\ f_{3}(t)&=-\frac{1}{6} t \left( t^2-9 t+2\right) ,\\ f_{4}(t)&=\frac{1}{24} t \left( t^3-18 t^2+35 t-42\right) ,\\ f_{5}(t)&=-\frac{1}{120} t \left( t^4-30 t^3+155 t^2-270 t+24\right) . \end{aligned}$$

As a consequence of the recurrence relation for \(\mathbf{f}(t)\), we get the following properties of the sequence \(\mathbf{f}(t)\).

Lemma 2.5

We have:

  1. (1)

    \({\text {deg}}f_{n}(t)=n\);

  2. (2)

    \(f_{0}(0)=1\) and \(f_{n}(0)=0\) for \(n>0\);

  3. (3)

    Let us write

    $$\begin{aligned} f_{n}(t)=\sum _{i=0}^{n}a(i,n)t^{i}. \end{aligned}$$

    Then \(a(0,0)=1, a(0,n)=0\) for \(n\in {\mathbb {N}}_{+}\) and for \(i\in \{0,\ldots ,n-1\}\) we have

    $$\begin{aligned} a(i+1,n)=\frac{1}{n}\sum _{j=i}^{n-1}\left( 1-2^{\nu _{2}(n-j)+1}\right) a(i,j). \end{aligned}$$
    (3)

    In particular we have the following equalities:

    $$\begin{aligned} a(n,n)&=\frac{(-1)^{n}}{n!},\\ a(n-1,n)&=\frac{(-1)^{n+1}}{2!(n-2)!}3,\quad n\ge 2,\\ a(n-2,n)&=\frac{(-1)^{n}}{4!(n-3)!}(27n-73),\quad n \ge 3,\\ a(1,n)&=\frac{1-2^{\nu _{2}(n)+1}}{n},\quad n\ge 1.\\ \end{aligned}$$
  4. (4)

    The sequence \(\mathbf{f}(t)\) satisfies the following addition formula:

    $$\begin{aligned} f_{n}(t_{1}+t_{2})=\sum _{k=0}^{n}f_{k}(t_{1})f_{n-k}(t_{2}), \end{aligned}$$

    where \(t_{1}, t_{2}\) are variables.

Proof

The first and the second statement follow immediately from Lemma 2.3.

In order to prove the third statement we use Lemma 2.3 one more time. For \(n\ge 1\) we have the following equalities:

$$\begin{aligned} f_{n}(t)=\sum _{i=0}^{n}a(i,n)t^{i}&=\frac{t}{n}\sum _{j=0}^{n-1} \left( 1-2^{\nu _{2}(n-j)+1}\right) \sum _{i=0}^{j}a(i,j)t^{i}\\&=\frac{1}{n}\sum _{i=0}^{n-1}\left( \sum _{j=i}^{n-1}\left( 1-2^{\nu _{2} (n-j)+1}\right) a(i,j)\right) t^{i+1}\\&=\frac{1}{n}\sum _{i=1}^{n}\left( \sum _{j=i-1}^{n-1}\left( 1-2^{\nu _{2} (n-j)+1}\right) a(i-1,j)\right) t^{i}. \end{aligned}$$

By comparing the coefficients of the polynomial \(f_{n}(t)\) and the polynomial given by the last expression, we get the result (after the change of variables \(i\rightarrow i+1\)).

In order to prove the expression for a(nn) we use Lemma 2.3 one more time. We immediately deduce the equality

$$\begin{aligned} a(n,n)=\frac{1}{n}\left( 1-2^{\nu _{2}(n-(n-1))+1}\right) a(n-1,n-1)=-\frac{1}{n}a(n-1,n-1). \end{aligned}$$

Using simple induction and the identity \(a(0,0)=1\), we get the expression for a(nn).

Next, we have \(a(1,2)=-3/2\) and for \(n\ge 2\) by (3) with \(i=n-2\) we get

$$\begin{aligned} a(n-1,n)= & {} -\frac{3}{n}a(n-2,n-2)-\frac{1}{n}a(n-2,n-1)\\= & {} -\frac{3}{n} \frac{(-1)^{n}}{(n-2)!}-\frac{1}{n}a(n-2,n-1). \end{aligned}$$

Using now simple induction, we easily get the expression for \(a(n-1,n)\) presented in the statement of our lemma.

Because exactly the same technique as used for the proof of expressions for a(nn) and \(a(n-1,n)\) can be applied in order to compute \(a(n-2,n)\), we omit the proof and leave the simple details for the reader.

Finally, in order to get the addition formula we notice that it is a simple consequence of the formal identity \(F_{t_{1}}(x)F_{t_{2}}(x)=F_{t_{1}+t_{2}}(x)\). \(\square \)

Remark 2.6

Although we were unable to find the general formula for the coefficients \(a(n-k,n)\) for all \(k\ge 4\) and \(n\ge k+1\), it is an easy (but tedious) exercise to prove that for fixed k we have

$$\begin{aligned} a(n-k,n)=\frac{(-1)^{n+k}}{(2k)!(n-k-1)!}W_{k}(n),\;n\ge k+1, \end{aligned}$$

where \(W_{k}\in {\mathbb {Z}}[n]\) is of degree \(k-1\).

Using this observation one can compute polynomials \(W_{k}(n)\) for several values of k:

$$\begin{aligned} W_{3}(n)&=45\left( 9 n^2-73 n+176\right) ,\\ W_{4}(n)&=7\left( 1215 n^3-19710 n^2+121685 n-266398\right) ,\\ W_{5}(n)&=945 \left( 243 n^4-6570 n^3+74165 n^2-394878 n+805440\right) ,\\ W_{6}(n)&=165 \Big (45927 n^5-1862595 n^4+33070275 n^3-310359581 n^2\\&\quad +1497391014 n-2916611728\Big ). \end{aligned}$$

We introduce the family of polynomials \(\mathbf{g}(t)=(g_{n}(t))_{n\in {\mathbb {N}}}\), where

$$\begin{aligned} g_{n}(t)=n!f_{n}(t). \end{aligned}$$

As a consequence of the recurrence relation for \(\mathbf{f}(t)\), we get the recurrence relation satisfied by the sequence \(\mathbf{g}(t)\) in the following form:

$$\begin{aligned} g_{0}(1)=1,\quad g_{n}(t)=t\sum _{k=0}^{n-1}\left( 1-2^{\nu _{2}(n-k)+1}\right) \frac{(n-1)!}{k!}g_{k}(t). \end{aligned}$$

In particular \(g_n(t)\in {\mathbb {Z}}[t]\) for each \(n\in {\mathbb {N}}\).

We have the following result concerning the factorization of \(g_{n}(t)\) modulo p, where p is a prime number.

Theorem 2.7

Let \(n\in {\mathbb {N}}\). Then

$$\begin{aligned} g_{n}(t)\equiv g_{n \bmod p}(t)(t-t^{p})^{\left\lfloor \frac{n}{p}\right\rfloor }\pmod {p}. \end{aligned}$$

Proof

Let p be a prime number. We proceed by induction on n. Our factorization is clearly true for \(n\le p-1\). If \(n=p\) then \(p\mid g_p(j)\) for any \(j\in {\mathbb {Z}}\). Since \(g_p(t)\in {\mathbb {Z}}[t]\), \(\deg g_p(t)=p\) and the leading coefficient of \(g_p(t)\) is \((-1)^p\), we thus have

$$\begin{aligned} g_p(t)\equiv (-1)^p\prod _{a=0}^{p-1} (t-a)\equiv t-t^p\pmod {p}. \end{aligned}$$

Let us consider the case \(n=pm+i\) for some \(i\in \{1,\ldots ,p\}\). Observe that

$$\begin{aligned}&\frac{(n-1)!}{k!}\\&\quad =\frac{(pm+i-1)!}{k!}\equiv {\left\{ \begin{array}{ll} \begin{array}{lll} 0, &{} \quad \text{ if }\;k\le pm-1 \\ \frac{(i-1)!}{j!}, &{} \quad \text{ if }\;k=pm+j,\;j\in \{0,1,\ldots ,i-1\} \end{array}\pmod {p}. \end{array}\right. } \end{aligned}$$

We have the following chain of congruences \(\bmod p\) for \(i\in \{1,\ldots ,p-1\}\):

$$\begin{aligned} g_{n}(t)&\equiv g_{pm+i}(t)\equiv t\sum _{k=0}^{pm+i-1} \left( 1-2^{\nu _{2}(pm+i-k)+1}\right) \frac{(pm+i-1)!}{k!}g_{k}(t)\\&\equiv t\sum _{k=0}^{pm-1}\left( 1-2^{\nu _{2}(pm+i-k)+1}\right) \frac{(pm+i-1)!}{k!}g_{k}(t)\\&\qquad +t\sum _{k=pm}^{pm+i-1}\left( 1-2^{\nu _{2}(pm+i-k)+1}\right) \frac{(pm+i-1)!}{k!}g_{k}(t)\\&\equiv t\sum _{k=pm}^{pm+i-1}\left( 1-2^{\nu _{2}(pm+i-k)+1}\right) \frac{(pm+i-1)!}{k!}g_{k}(t)\\&\equiv t\sum _{j=0}^{i-1}\left( 1-2^{\nu _{2}(i-j)+1}\right) \frac{(i-1)!}{j!}g_{j}(t)(t-t^{p})^{m}\\&\equiv (t-t^{p})^{m}t\sum _{j=0}^{i-1}\left( 1-2^{\nu _{2}(i-j)+1}\right) \frac{(i-1)!}{j!}g_{j}(t)\\&\equiv g_{i}(t)(t-t^{p})^{m}\equiv g_{n\bmod {p}}(t) (t-t^{p})^{\lfloor \frac{n}{p}\rfloor }\pmod {p}. \end{aligned}$$

If \(i=p\) then in the same way we obtain

$$\begin{aligned} g_{n}(t)\equiv g_p(t)(t-t^{p})^{\lfloor \frac{m}{p}\rfloor }\equiv (t-t^{p})^{\lfloor \frac{m}{p}\rfloor +1}\pmod {p}. \end{aligned}$$

Our result follows. \(\square \)

3 Arithmetic properties of the sequence \((f_{n}(t))_{n\in {\mathbb {N}}}\) with \(t\in {\mathbb {N}}_{+}\)

In this section we consider the sequence \((f_{n}(t))_{n\in {\mathbb {N}}}\) with a fixed positive integer t. We thus write \(t=m\) for \(m\in {\mathbb {N}}_{+}\) and define

$$\begin{aligned} t_{m}(n):=f_{n}(m). \end{aligned}$$

Moreover, we put \(\mathbf{t}_{m}=(t_{m}(n))_{n\in {\mathbb {N}}}\). In particular \(\mathbf{t}_{1}=(t_{1}(n))_{n\in {\mathbb {N}}}=((-1)^{s_{2}(n)})_{n\in {\mathbb {N}}}=(t_{n})_{n\in {\mathbb {N}}}\) is the Prouhet–Thue–Morse sequence. It is clear that \(\mathbf{t}_{m}\) is the sequence obtained from the convolution of m copies of the Prouhet–Thue–Morse sequence, i.e.,

$$\begin{aligned} t_{m}(n)=\sum _{i_{1}+i_{2}+\cdots +i_{m}=n}(-1)^{\sum _{k=1}^{m}s_{2}(i_{k})}. \end{aligned}$$
(4)

3.1 Results concerning the computation of the 2-adic valuation of \(t_{m}(n)\)

This subsection is devoted to the presentation of the results concerning the explicit computation of the 2-adic valuation of the sequence \(\mathbf{t}_{m}\) for \(m=2^{k}\) and \(m=3\).

From the functional equation for \(F_{m}(x)\) we easily deduce the following useful result.

Lemma 3.1

Let m be a positive integer. Then \(t_m(0)=1\), \(t_m(1)=-m\) and

$$\begin{aligned} t_m(2n)=\sum _{j=0}^{\left\lfloor \frac{m}{2}\right\rfloor } {m\atopwithdelims ()2j}t_m(n-j),\quad t_m(2n+1)=-\sum _{j=0}^{\left\lfloor \frac{m-1}{2}\right\rfloor } {m\atopwithdelims ()2j+1}t_m(n-j), \end{aligned}$$

where we put \(t_m(n)=0\) for \(n<0\).

Proof

Let us expand \(F_m(x)\) using the functional equation \(F_m(x)=(1-x)^mF_m(x^2)\).

$$\begin{aligned} \begin{aligned} F_m(x)&=(1-x)^mF_m(x^2)=\left( \sum _{j=0}^m {m\atopwithdelims ()j}(-1)^jx^j\right) \left( \sum _{k=0}^{\infty } t_m(k)x^{2k}\right) \\&=\left( \sum _{j=0}^{\left\lfloor \frac{m}{2}\right\rfloor } {m\atopwithdelims ()2j}x^{2j}-\sum _{j=0}^{\left\lfloor \frac{m-1}{2}\right\rfloor } {m\atopwithdelims ()2j+1}x^{2j+1}\right) \left( \sum _{k=0}^{\infty } t_m(k)x^{2k}\right) \\&=\sum _{n=0}^{\infty }\left[ \left( \sum _{j=0}^{\left\lfloor \frac{m}{2}\right\rfloor } {m\atopwithdelims ()2j}t_m(n-j)\right) x^{2n}{-}\left( \sum _{j=0}^{\left\lfloor \frac{m-1}{2}\right\rfloor } {m\atopwithdelims ()2j+1}t_m(n-j)\right) x^{2n+1}\right] \end{aligned} \end{aligned}$$

Comparing coefficients of the first and last expression, we obtain the recurrence relations in the statement of our lemma. \(\square \)

Lemma 3.2

Let m be a positive integer. Then \(F_{m}(x)\equiv (1+x)^{-m}\pmod {2}\). In particular,

$$\begin{aligned} t_{m}(n)\equiv {n+m-1\atopwithdelims ()m-1}\pmod {2} \end{aligned}$$
(5)

for each \(n\in {\mathbb {N}}\).

Proof

In order to prove our result let us recall the identity \(\prod _{n=0}^{\infty }(1+x^{2^{n}})=\frac{1}{1-x}\). We thus have

$$\begin{aligned} F_{m}(x)&\equiv \prod _{n=0}^{\infty }\left( 1+x^{2^{n}}\right) ^{m}\equiv \left( \prod _{n=0}^{\infty }\left( 1+x^{2^{n}}\right) \right) ^{m}\\&\equiv \frac{1}{(1-x)^{m}}\equiv \sum _{n=0}^{\infty }{n+m-1\atopwithdelims ()m-1}x^{n}\pmod {2}. \end{aligned}$$

This proves the first part of our lemma. In order to get the second part we compare the coefficients (modulo 2) of \(x^{n}\) on both sides of the first and last term in the above congruence. Our result follows. \(\square \)

We can strengthen the result above for \(m=2^k\), \(k\in {\mathbb {N}}\). Namely

Theorem 3.3

Let \(k\in {\mathbb {N}}\). Then \(\nu _2(t_{2^k}(n))=\nu _2\left( n+2^k-1\atopwithdelims ()2^k-1\right) \) for each \(n\in {\mathbb {N}}\). In other words,

$$\begin{aligned} \nu _2(t_{2^k}(2^kn+j))= {\left\{ \begin{array}{ll} k-\nu _2(j)+\nu _2(n+1) &{} \text{ when } j\in \{1,\dots ,2^k-1\} \\ 0 &{} \text{ when } j=0 \end{array}\right. } \end{aligned}$$
(6)

for \(n\in {\mathbb {N}}\).

Proof

Let us note that

$$\begin{aligned}&\nu _2\left( \left( 2^kn+j\right) +2^k-1\atopwithdelims ()2^k-1\right) =\nu _2\left( 2^k(n+1)+j-1\atopwithdelims ()2^k-1\right) \\&\quad =\nu _2\left( \frac{2^k}{j}{2^k(n+1)+j\atopwithdelims ()2^k}\right) \\&\quad =k-\nu _2(j)+s_2\left( 2^k\right) +s_2\left( 2^kn+j\right) -s_2\left( 2^k(n+1)+j\right) \\&\quad =k-\nu _2(j)+1+s_2(n)+s_2(j)-s_2(n+1)-s_2(j)\\&\quad =k-\nu _2(j)+\nu _2\left( n+1\atopwithdelims ()n\right) =k-\nu _2(j)+\nu _2(n+1), \end{aligned}$$

where we used Legendre’s formula \(\nu _2\left( n!\right) =n-s_2(n)\) (see [12]). By the above equality and the fact that each nonnegative integer can be represented in the form \(2^kn+j\) for some \(n\in {\mathbb {N}}\) and \(j\in \{0,1,\dots ,2^k-1\}\), it suffices to show by induction on \(2^kn+j\in {\mathbb {N}}\) that equality (6) holds (we recall that \(t_m(n)=0\) for \(n<0\)). Clearly the statement is true for \(2^kn+j\le 1\). Let us compute the 2-adic valuation of the numbers \(t_{2^k}(2^{k+1}n+2j)\) and \(t_{2^k}(2^{k+1}n+2j+1)\), where \(n\in {\mathbb {N}}\) and \(j\in \{0,1,\dots ,2^k-1\}\) and \(2^{k+1}n+2j\ge 2\). By Lemma 3.1, we have

$$\begin{aligned} t_{2^k}(2^{k+1}n+2j)=\sum _{i=0}^{2^{k-1}} {2^k\atopwithdelims ()2i}t_{2^k}\left( 2^kn+j-i\right) \end{aligned}$$
(7)

If \(j\in \{0,2^{k-1}\}\) then only the summand for \(i=j\) is odd, thus \(t_{2^k}(2^{k+1}n+2j)\) is odd. Let \(j\not \in \{0,2^{k-1}\}\). Then we compute 2-adic valuation of each summand of the sum in (7). We start with the 2-adic valuation of \({2^k\atopwithdelims ()2i}\).

$$\begin{aligned} \nu _2\left( {2^k\atopwithdelims ()2i}\right)&=\nu _2\left( \frac{2^k}{2i}{2^k-1\atopwithdelims ()2i-1}\right) \\&=k-1-\nu _2(i)+s_2(2i-1)+s_2\left( 2^k-2i\right) -s_2\left( 2^k-1\right) \\&=k-1-\nu _2(i), \quad i>0 \end{aligned}$$

By the above equality and the induction hypothesis, we obtain

$$\begin{aligned}&\nu _2\left( {2^k\atopwithdelims ()2i}t_{2^k}(2^kn+j-i)\right) \nonumber \\&\quad = {\left\{ \begin{array}{ll} k-\nu _2(j)+\nu _2(n+1), &{} \text{ if } i=0 \\ 2k-1-\nu _2(i)-\nu _2(j-i)+\nu _2(n+1), &{} \text{ if } 0<i<j \\ k-1-\nu _2(j), &{} \text{ if } i=j \\ 2k-1-\nu _2(i)-\nu _2(j-i)+\nu _2(n), &{} \text{ if } i>j \end{array}\right. }. \end{aligned}$$

Let us notice that

$$\begin{aligned} k-\nu _2(j)+\nu _2(n+1)\le 2k-1-\nu _2(i)-\nu _2(j-i)+\nu _2(n+1), \end{aligned}$$
(8)

when \(0<i\le 2^{k-1}\) and \(i\ne j\). Indeed, the inequality (8) is equivalent to

$$\begin{aligned} \nu _2(i)+\nu _2(j-i)\le k-1+\nu _2(j). \end{aligned}$$
(9)

If \(\nu _2(i)\le \nu _2(j)\) then (9) holds, since \(0<|j-i| < 2^k\) and in consequence \(\nu _2(j-i)\le k-1\). If \(\nu _2(i)>\nu _2(j)\) then \(\nu _2(j-i)=\nu _2(j)\) and \(\nu _2(i)\le k-1\), since \(0<i\le 2^{k-1}\). Now we see that the jth summand of the sum in (7) has the 2-adic valuation less than any other summand. Indeed,

$$\begin{aligned} k-1-\nu _2(j)<k-\nu _2(j)+\nu _2(n+1)\le 2k-1-\nu _2(i)-\nu _2(j-i)+\nu _2(n+1) \end{aligned}$$

and

$$\begin{aligned} k-1-\nu _2(j)<k-\nu _2(j)+\nu _2(n)\le 2k-1-\nu _2(i)-\nu _2(j-i)+\nu _2(n). \end{aligned}$$

We thus infer that \(\nu _2(t_{2^k}(2^{k+1}n+2j))=k-\nu _2(2j)=k-\nu _2(2j)+\nu _2(2n+1)\) when \(0<j<2^{k-1}\). If \(j>2^{k-1}\) then by (8) we know that the 0th summand of the sum in (7) has the least 2-adic valuation. It suffices to check for which \(i\in \{1,\dots ,2^{k-1}\}\) the ith summand has the same 2-adic valuation as the 0th one, or, in other words, we have equality in (9). Equality in (9) holds only if \(i=2^{k-1}\) or \(i=j-2^{k-1}\). Hence in the sum in (7) there are three summands with minimal 2-adic valuation. As a consequence, \(\nu _2(t_{2^k}(2^{k+1}n+2j))=k-\nu _2(j)+\nu _2(n+1)=k-\nu _2(2j)+\nu _2(2n+2)\). We are left with the computation of \(t_{2^k}(2^{k+1}n+2j+1)\). By Lemma 3.1, we have

$$\begin{aligned} t_{2^k}\left( 2^{k+1}n+2j+1\right) =-\sum _{i=0}^{2^{k-1}-1} {2^k\atopwithdelims ()2i+1}t_{2^k}\left( 2^kn+j-i\right) \end{aligned}$$
(10)

We start with the 2-adic valuation of \({2^k\atopwithdelims ()2i+1}\) when \(0\le i<2^{k-1}\).

$$\begin{aligned} \nu _2\left( {2^k\atopwithdelims ()2i+1}\right)&=\nu _2\left( \frac{2^k}{2i+1}{2^k-1\atopwithdelims ()2i}\right) \\&=k-\nu _2(2i+1)+s_2(2i)+s_2\left( 2^k-2i-1\right) -s_2\left( 2^k-1\right) =k. \end{aligned}$$

By the above equality and the induction hypothesis we obtain

$$\begin{aligned} \nu _2\left( {2^k\atopwithdelims ()2i+1}t_{2^k}\left( 2^kn+j-i\right) \right) = {\left\{ \begin{array}{ll} 2k-\nu _2(j-i)+\nu _2(n+1), &{} \text{ if } \,0\le i<j \\ k, &{} \text{ if } \, i=j \\ 2k-\nu _2(j-i)+\nu _2(n), &{} \text{ if } \, i>j \end{array}\right. }. \end{aligned}$$

Since \(0\le i,j<2^k\), thus for \(i\ne j\) we have \(0<|j-i|<2^k\). This implies \(\nu _2(j-i)<k\) and hence \(k<2k-\nu _2(j-i)\). This means that for \(j<2^{k-1}\) the jth summand in (10) has the 2-adic valuation less than any other summand and \(\nu _2(t_{2^k}(2^{k+1}n+2j+1))=k=k-\nu _2(2j+1)+\nu _2(2n+1)\). If \(j\ge 2^{k-1}\) then the \(j-2^{k-1}\)th summand in (10) has the 2-adic valuation less than any other summand and \(\nu _2(t_{2^k}(2^{k+1}n+2j+1))=k+1+\nu _2(n+1)=k-\nu _2(2j+1)+\nu _2(2n+2)\). This finishes the proof. \(\square \)

Corollary 3.4

For each \(k\in {\mathbb {N}}\) the sequence \((\nu _2(t_{2^k}(n)))_{n\in {\mathbb {N}}}\) is 2-regular, i.e., the \({\mathbb {Z}}\)-submodule of \({\mathbb {Z}}^{{\mathbb {N}}}\) generated by sequences \((\nu _2(t_{2^k}(2^ln+j)))_{n\in {\mathbb {N}}}\), \(l\in {\mathbb {N}}\), \(j\in \{0,1,\dots ,2^l-1\}\), is finitely generated (see [2]).

Proof

It suffices to show that the sequences \((1)_{n\in {\mathbb {N}}}\) and \((\nu _2(n+1))_{n\in {\mathbb {N}}}\) lie in the \({\mathbb {Z}}\)-submodule of \({\mathbb {Z}}^{{\mathbb {N}}}\) generated by sequences \((\nu _2(t_{2^k}(2^ln+j)))_{n\in {\mathbb {N}}}\), \(l\ge k\), \(j\in \{0,1,\dots ,2^l-1\}\), and generate these sequences. Obviously, \((1)_{n\in {\mathbb {N}}}=(\nu _2(t_{2^k}(2^kn+1)))_{n\in {\mathbb {N}}}-(\nu _2(t_{2^k}(2^kn+2)))_{n\in {\mathbb {N}}}\) and \((\nu _2(n+1))_{n\in {\mathbb {N}}}\) can be written as \((\nu _2(t_{2^k}(2^kn+2^{k-1})))_{n\in {\mathbb {N}}}-(1)_{n\in {\mathbb {N}}}\). Now, we prove by induction on \(l\ge k\) that \((\nu _2(t_{2^k}(2^ln+j)))_{n\in {\mathbb {N}}}\) is of the form \((\alpha +\beta \nu _2(n+1))_{n\in {\mathbb {N}}}\), where \(\alpha \in {\mathbb {N}}\) and \(\beta \in \{0,1\}\). This statement is true for \(l=k\) by Theorem 3.3. For \(l>k\) we write \(j=2^{l-1}s+j'\), where \(s\in \{0,1\}\) and \(0\le j'\le 2^{l-1}-1\). Then by induction hypothesis we get the following

$$\begin{aligned}&\left( \nu _2\left( t_{2^k}\left( 2^ln+j\right) \right) \right) _{n\in {\mathbb {N}}}=\left( \nu _2\left( t_{2^k}\left( 2^{l-1}(2n+s)+j'\right) \right) \right) _{n\in {\mathbb {N}}}\\&\quad =\left( \alpha +\beta \nu _2(2n+s+1)\right) _{n\in {\mathbb {N}}}=(\alpha +\beta s+\beta s\nu _2(n+1))_{n\in {\mathbb {N}}}, \end{aligned}$$

where the last equality holds because \(\nu _2(2n+s+1)=s+s\nu _2(n+1)\) for \(n\in {\mathbb {Z}}\) and \(s\in \{0,1\}\). \(\square \)

We can also describe the 2-adic valuation of the numbers \(t_3(n)\), \(n\in {\mathbb {N}}\). We start with the following simple lemma.

Lemma 3.5

For each \(n\in {\mathbb {N}}\) we have

$$\begin{aligned} t_3(4n+2)=8t_3(n-1),\quad t_3(4n+3)=8t_3(n), \end{aligned}$$

where \(t_3(-1)=0\).

Proof

It suffices to use the recurrence for the sequence \((t_3(n))_{n\in {\mathbb {N}}}\) twice.

$$\begin{aligned} t_3(4n+3)&=-3t_3(2n+1)-t_3(2n)=9t_3(n)+3t_3(n-1)-t_3(n)-3t_3(n-1)=8t_3(n),\\ t_3(4n+2)&=t_3(2n+1)+3t_3(2n)=-3t_3(n)-t_3(n-1)+3t_3(n)+9t_3(n-1)=8t_3(n-1). \end{aligned}$$

\(\square \)

Proposition 3.6

For each \(n\in {\mathbb {N}}\) the following equalities hold:

$$\begin{aligned} \nu _2(t_3(4n))=\nu _2(t_3(4n+1))&=0,&\\ \nu _2(t_3(4n+3))=\nu _2(t_3(4n+6))&=3+\nu _2(t_3(n)), \end{aligned}$$

where in the second equality we assume that \(t_3(n)=0\) for \(n<0\).

Proof

The numbers \(t_3(4n)\) and \(t_3(4n+1)\) are odd by Lemma 3.2. For the proof of the equality \(\nu _2(t_3(4n+3))=\nu _2(t_3(4n+6))=3+\nu _2(t_3(n))\) we use Lemma 3.5. \(\square \)

One can prove by induction on \(n\in {\mathbb {N}}_+\) that every positive integer n can be uniquely written in the form \(n=\sum _{j=0}^d 4^ja_j\), where \(a_j\in \{0,1,3,6\}\) for \(j<d\) and \(a_d\in \{1,2,3,6\}\). Then the 2-adic valuation of \(t_3(n)\), \(n\in {\mathbb {N}}_+\) can be described in the following way.

Theorem 3.7

For each \(n\in {\mathbb {N}}_+\) there holds

$$\begin{aligned} \nu _2(t_3(n))= {\left\{ \begin{array}{ll} +\infty , &{} \text{ if } \,a_d=2 \text{ and } a_j\in \{3,6\} \text{ for } j<d\\ 3k, &{} \text{ if } \, k=\max \{l\in \{1,\dots ,d+1\}: a_j\in \{3,6\} \text{ for } j<l\}\\ &{} \text{ and } \, (a_d\ne 2 \text{ or } k<d) \end{array}\right. }. \end{aligned}$$

Proof

The proof will be performed by induction on d. If \(d=0\) then \(n\le 6\) and we check the statement of our theorem one by one. If \(d>0\) then we write \(n=4n'+a_0\). Then \(n'=\sum _{j=0}^{d-1} 4^jb_j\), where \(b_j=a_{j+1}\) for \(j\in \{0,\dots ,d-1\}\). If \(a_0\in \{0,1\}\) then by Proposition 3.6 the number \(t_3(n)\) is odd and our assertion follows. If \(a_0\in \{3,6\}\) then we use Proposition 3.6 and the induction hypothesis to obtain the following:

$$\begin{aligned}&\nu _2(t_3(n))=3+\nu _2(t_3(n'))\\&={\left\{ \begin{array}{ll} +\infty , &{} \text{ if } b_{d-1}=2 \text{ and } b_j\in \{3,6\} \text{ for } j\in \{1,\dots ,d-1\}\\ 3+3k, &{} \text{ if } b_{d-1}\ne 2 \text{ and } k=\max \{l\in \{0,\dots ,d\}: b_j\in \{3,6\} \text{ for } j<l\} \end{array}\right. }\\&= {\left\{ \begin{array}{ll} +\infty , &{} \text{ if } a_d=2 \text{ and } a_j\in \{3,6\} \text{ for } j<d\\ 3k, &{} \text{ if } a_d\ne 2 \text{ and } k=\max \{l\in \{1,\dots ,d+1\}: a_j\in \{3,6\} \text{ for } j<l\} \end{array}\right. }. \end{aligned}$$

\(\square \)

3.2 Unboundedness of \(\mathbf{t}_{m}\) for \(m=2^{k}\) and \(m=3\)

As an application of Lemma 3.1 we get:

Theorem 3.8

If \(m\in {\mathbb {N}}_{\ge 2}\) then we have

$$\begin{aligned} t_{m}(n)=O(n^{\frac{m}{2}}) \end{aligned}$$

for each \(n\in {\mathbb {N}}\).

Proof

We will prove by induction that

$$\begin{aligned} |t_m(n)|\le mn^{\frac{m}{2}}. \end{aligned}$$

Clearly, the above inequality holds for \(n\in \{0,1\}\). If \(n>1\) and is even then we write \(n=2n'\) for some \(n'\in {\mathbb {N}}\). We use Lemma 3.1 and the induction hypothesis (we recall that \(t_m(n)=0\) for \(n<0\)).

$$\begin{aligned} |t_m(n)|&=|t_m(2n')|=\left| \sum _{j=0}^{\lfloor \frac{m}{2}\rfloor } {m\atopwithdelims ()2j}t_m(n'-j)\right| \le \sum _{j=0}^{\lfloor \frac{m}{2}\rfloor } {m\atopwithdelims ()2j}|t_m(n'-j)|\\&\quad <\sum _{j=0}^{\lfloor \frac{m}{2}\rfloor } {m\atopwithdelims ()2j}m(n')^{\frac{m}{2}}=m(2n')^{\frac{m}{2}}=mn^{\frac{m}{2}}. \end{aligned}$$

If \(n>1\) is odd then we write \(n=2n'+1\) for some \(n'\in {\mathbb {N}}\) and by Lemma 3.1 we obtain the following:

$$\begin{aligned} |t_m(n)|&=|t_m(2n'+1)|=\left| \sum _{j=0}^{\lfloor \frac{m-1}{2}\rfloor } {m\atopwithdelims ()2j{+}1}t_m(n'-j)\right| {\le }\sum _{j=0}^{\lfloor \frac{m-1}{2}\rfloor } {m\atopwithdelims ()2j+1}|t_m(n'-j)|\\&\quad<\sum _{j=0}^{\lfloor \frac{m-1}{2}\rfloor } {m\atopwithdelims ()2j+1}m(n')^{\frac{m}{2}}=m(2n')^{\frac{m}{2}}<mn^{\frac{m}{2}}. \end{aligned}$$

\(\square \)

Let us observe that the crude estimation using the fact that \(|t_{1}(n)|=1\) gives only the equality \(t_{m}(n)=O(n^{m})\). The above result shows that there is a lot of cancellation in the sum defining \(t_{m}(n)\) and it is quite natural to ask whether the sequence \(\mathbf{t}_{m}\) is bounded or not. Unfortunately, we were unable to answer this question in general but we believe that the following is true.

Conjecture 3.9

For each \(m\in {\mathbb {N}}_{\ge 2}\) we have \(\limsup _{n\rightarrow +\infty }t_{m}(n)=+\infty \) and \(\liminf _{n\rightarrow +\infty }t_{m}(n)=-\infty \).

The next result shows that if the sequence \(\mathbf{t}_{m}\) is unbounded on one side then it is unbounded on both sides.

Lemma 3.10

Let \(m \ge 2\). If \(\displaystyle \limsup _{n \rightarrow \infty } |t_m(n)| = +\infty \) then \(\displaystyle \limsup _{n \rightarrow \infty } t_m(n) = +\infty \) and \(\displaystyle \liminf _{n \rightarrow \infty } t_m(n) = -\infty \).

Proof

Suppose that \(\displaystyle \limsup _{n \rightarrow \infty } t_m(n) = +\infty \) and \(t_m(n) \ge -C\) for some positive constant C. We have that

$$\begin{aligned} C \ge -t_m(2n+1) = \sum _{i=0}^{[\frac{m-1}{2}]} \left( {\begin{array}{c}m\\ 2i+1\end{array}}\right) t_m(n-i) \end{aligned}$$

Therefore,

$$\begin{aligned} C+C\sum _{i=0}^{[\frac{m-1}{2}]} \left( {\begin{array}{c}m\\ 2i+1\end{array}}\right) \ge \sum _{i=0}^{[\frac{m-1}{2}]} \left( {\begin{array}{c}m\\ 2i+1\end{array}}\right) (t_m(n-i)+C) \ge m (t_m(n)+C) \end{aligned}$$

The number \(C+C\displaystyle \sum _{i=0}^{[\frac{m-1}{2}]} \left( {\begin{array}{c}m\\ 2i+1\end{array}}\right) \) is a constant independent of n. From our assumption \(\limsup \nolimits _{n \rightarrow \infty } m (t_m(n)+C) = + \infty \) so we get a contradiction.

One can prove our lemma in the remaining case \(\liminf \nolimits _{n \rightarrow \infty } t_m(n) = -\infty \) and \(t_m(n) < C\) for some positive constant C, by replacing \(t_m(n)\) by \(-t_m(n)\). \(\square \)

Using the expression for \(\nu _{2}(t_{2^{k}}(n))\) presented in Theorem 3.3 and the above result, we immediately get

Theorem 3.11

The Conjecture 3.9 is true for \(m=2^{k}\) and \(m = 3\).

Proof

Apply Theorem 3.3 in the case of \(m=2^{k}\) and Theorem 3.6 in the case of \(m=3\).

In the case of \(m=2, 3\) we can give more precise result. Let

$$\begin{aligned}&{\text {Max}}_{m}(k)={\text {max}}\{t_{m}(n):\;n\in [0,2^{k}]\},\\&{\text {Min}}_{m}(k)={\text {min}}\{t_{m}(n):\;n\in [0,2^{k}]\}. \end{aligned}$$

Theorem 3.12

Let \(k\in {\mathbb {N}}_3\). We have the following equalities:

$$\begin{aligned} \begin{array}{lllll} {\text {Max}}_{2}(k) &{} = &{}2^{2\lfloor \frac{k}{2}\rfloor } &{} = &{}t_{2}(2^{2\lfloor \frac{k}{2}\rfloor }-1),\\ {\text {Min}}_{2}(k) &{} = &{} -2^{2\left\lfloor \frac{k-1}{2}\right\rfloor +1} &{} = &{}t_2\left( 2^{2\left\lfloor \frac{k-1}{2}\right\rfloor +1}-1\right) . \end{array} \end{aligned}$$

Moreover, for \(m=3\) and \(k\in {\mathbb {N}}\) we have

$$\begin{aligned} \begin{aligned} {\text {Max}}_{3}(2k)&= 2^{3k}, \\ {\text {Max}}_{3}(2k+1)&= \frac{15}{7}\left( 2^{3k}-1\right) +[k=0], \\ {\text {Min}}_{3}(2k)&= -\frac{3}{7}\left( 2^{3k+1}+5\right) , \\ {\text {Min}}_{3}(2k+1)&= -3\cdot 2^{3k}, \end{aligned} \end{aligned}$$

and

$$\begin{aligned}&{\text {Max}}_{3}(k)=t_{3}\left( 2^{k}-\frac{1}{2}\left( 1+(-1)^{k}\right) \right) , \quad k\ge 1,\\&{\text {Min}}_{3}(k)=t_{3}\left( 2^{k}-\frac{1}{2}\left( 1-(-1)^{k}\right) \right) . \end{aligned}$$

Proof

We start with the case of \(m=2\). First, let us observe that \(t_2(2^k-1)=(-2)^k\) for each \(k\in {\mathbb {N}}_+\). We will prove by induction on \(k\in {\mathbb {N}}_3\) the following statement:

$$\begin{aligned} \text {If }n\in & {} \left\{ 0,\dots ,2^k\right\} \backslash \left\{ 2^{k-1}-1, 2^k-1\right\} \text { then } |t_2(n)|<2^{k-1}\text { and }\\&\text{ sgn } t_2\left( 2^k-2\right) =\text{ sgn } t_2\left( 2^k\right) = -\text{ sgn } t_2\left( 2^k-1\right) . \end{aligned}$$

Clearly, our statement is true for \(k=3\). Let us assume that the statement holds for some \(k\in {\mathbb {N}}_3\). We will show that it holds for \(k+1\). If \(n\le 2^k\) and \(n\ne 2^k-1\) then obviously \(|t_2(n)|<2^k\). Hence it suffices to prove the statement for \(n>2^k\). Let us consider the case \(n=2l\). If \(l\not \in \{2^k-1, 2^k\}\) then \(|t_2(n)|\le |t_2(l)|+|t_2(l-1)|<2^k\), since \(|t_2(l)|\) and \(|t_2(l-1)|\) are less than \(2^{k-1}\). If \(l=2^k-1\) then we use the facts that \(0<|t_2(2^k-2)|<2^{k-1}<|t_2(2^k-1)|\) and \(\text{ sgn } t_2(2^k-2)=-\text{ sgn } t_2(2^k-1)\) to obtain \(|t_2(2^{k+1}-2)|=|t_2(2^k-1)+t_2(2^k-2)|<|t_2(2^k-1)|=2^k\) and \(\text{ sgn } t_2(2^{k+1}-2)=\text{ sgn } t_2(2^k-1)=\text{ sgn } \left( -\frac{1}{2}t_2(2^{k+1}-1)\right) =-\text{ sgn } t_2(2^{k+1}-1)\). Analogously we prove that \(|t_2(2^{k+1})|<2^k\) and \(\text{ sgn } t_2(2^{k+1})=-\text{ sgn } t_2(2^{k+1}-1)\). We are left with the case \(n=2l+1\). If \(n=2l+1\ne 2^{k+1}-1\) then \(l\ne 2^k-1\). Since \(l\le 2^k\), by induction hypothesis we have \(|t_2(n)|=2|t_2(l)|<2^{k}\).

Summing up our discussion, if \(k\in {\mathbb {N}}_3\) and \(n\in \{0,\dots ,2^k\}\) then \(t_2(n)\) takes on extremal values for \(n\in \{2^{k-1}-1, 2^k-1\}\).

In order to get expressions for \({\text {Max}}_{3}(k)\) and \({\text {Min}}_{3}(k)\) we introduce some notation. Let \(F_{1}(k)\) (respectively \(F_{2}(k)\)) be the right side of the expression for \({\text {Max}}_{3}(k)\) (respectively \({\text {Min}}_{3}(k)\)) from the statement of our theorem. In the sequel we will need the following fact: if \(k\in {\mathbb {N}}_{+}\) and \(n\in \{0,\ldots ,2^{k}-2\}\), then

$$\begin{aligned} \frac{1}{2}F_{2}(k)<t_{3}(n)<\frac{1}{2}F_{1}(k). \end{aligned}$$
(11)

One can easily check that \(2F_{1}(k)<F_{1}(k+1)\), \(2F_{2}(k)>F_{2}(k+1)\), \(-2F_{2}(k)<F_{1}(k+1)\) and \(-2F_{1}(k)>F_{2}(k+1)\) for \(k\in {\mathbb {N}}\).

The proof follows by simple induction on k. Indeed, the statement is true for \(k=0, 1, 2, 3\). Suppose that our inequalities hold for some \(k\ge 4\) and take \(n\in \{0,\ldots ,2^{k+1}-2\}\). We consider two cases: n even and n odd.

If \(n=2n'\) then \(n'\in \{0,\ldots ,2^{k}-1\}\). If \(n'=2^{k}-1\) then a simple computation reveals that

$$\begin{aligned} t_{3}(n)=t_{3}(2n')=t_{3}\left( 2^{k+1}-2\right) =\frac{1}{2}\left( 1+(-1)^{k}\right) 2^{\frac{3k}{2}} \end{aligned}$$

and that the inequalities (11) are true in this case. If \(n'\in \{0,\ldots ,2^{k}-2 \}\) then applying the recurrence relations and the induction hypothesis, we get

$$\begin{aligned} t_{3}(n)=t_{3}(2n')=t_{3}(n')+3t_{3}(n'-1)<\frac{1}{2}F_{1}(k) +\frac{3}{2}F_{1}(k)=2F_{1}(k)<F_{1}(k+1). \end{aligned}$$

Similarly,

$$\begin{aligned} t_{3}(n)=t_{3}(n')+3t_{3}(n'-1)>\frac{1}{2}F_{2}(k)+\frac{3}{2}F_{2}(k) =2F_{2}(k)>F_{2}(k+1). \end{aligned}$$

If n is odd then \(n=2n'+1\) for some \(n'\in \{0,\ldots ,2^{k}-2\}\) and then

$$\begin{aligned} t_{3}(n)= & {} t_{3}(2n'+1)=-3t_{3}(n')-t_{3}(n'-1)<-\frac{3}{2}F_{2}(k) -\frac{1}{2}F_{2}(k)\\= & {} -2F_{2}(k)<F_{1}(k+1). \end{aligned}$$

Similarly

$$\begin{aligned} t_{3}(n)=-3t_{3}(n')-t_{3}(n'-1)>-\frac{3}{2}F_{1}(k)-\frac{1}{2}F_{1}(k) =-2F_{1}(k)>F_{2}(k+1). \end{aligned}$$

In order to finish the proof it is enough to observe the equalities

$$\begin{aligned} F_{1}(k)=t_{3}\left( 2^{k}-\frac{1}{2}\left( 1+(-1)^{k}\right) \right) ,\quad F_{2}(k)=t_{3}\left( 2^{k}-\frac{1}{2}\left( 1-(-1)^{k}\right) \right) \end{aligned}$$

and thus \(F_{1}(k)={\text {Max}}\{t_{3}(n):\;n\in \{0,\ldots ,2^{k}\}\}\) and \(F_{2}(k)={\text {Min}}\{t_{3}(n):\;n\in \{0,\ldots ,2^{k}\}\}\). Our result follows. \(\square \)

3.3 Vanishing of \(t_{3}(n)\) and more properties of \(\mathbf{t}_{2}\)

In Theorem 3.3 we have found the explicit formula for 2-adic valuation of \(t_{2^{k}}(n)\). Because the computed numbers are finite for each \(n\in {\mathbb {N}}\), as a consequence we get that the equation \(t_{2^{k}}(n)=0\) has no solution for each k. Because \(t_{3}(2)=0\) it is quite natural to ask about a precise description of the sequence \((a_{k})_{k\in {\mathbb {N}}_{+}}\) defined by the property

$$\begin{aligned} t_{3}(n)=0\Longleftrightarrow n=a_{k}\;\text{ for } \text{ some }\;k\in {\mathbb {N}}_{+}. \end{aligned}$$

Although a description is given in Theorem 3.6 in terms of the expansion of the integer n in base 4 with digits from the set \(\{0,1,3,6\}\), we present a different one in terms of recurrence sequences. More precisely, we have the following.

Theorem 3.13

We have \(t_{2^k}(n)\ne 0\) for all \(k,n\in {\mathbb {N}}\). Moreover, \(t_{3}(n)=0\Leftrightarrow n=a_{k}\) for some \(k\in {\mathbb {N}}_{+}\), where the sequence \((a_{k})_{k\in {\mathbb {N}}_+}\) satisfies the recurrence relation: \(a_{1}=2\) and

$$\begin{aligned} a_{2k}=4a_{k}+3,\quad a_{2k+1}=4a_{k}+6 \end{aligned}$$

for \(k\ge 1\)

Proof

The first part of our theorem is very easy. Indeed, we have \(\nu _2(t_{2^k}(n))=\nu _2\left( n+2^k-1\atopwithdelims ()2^k-1\right) \). Since \({n+2^k-1\atopwithdelims ()2^k-1}\ne 0\), thus \(t_{2^k}(n)\ne 0\).

In order to prove the second part of our theorem we use the results obtained in Lemma 3.5 and Proposition 3.6, namely

$$\begin{aligned} t_{3}(4n)&\equiv 1\pmod {2},\\ t_{3}(4n+1)&\equiv 1\pmod {2}. \end{aligned}$$

and

$$\begin{aligned} t_{3}(4n+3)=8t_{3}(n),\quad \quad t_{3}(4n+6)=8t_{3}(n). \end{aligned}$$
(12)

In particular \(t_{3}(n)\ne 0\) for \(n\equiv 0,1\pmod {4}\).

The equalities in (12) show that if \(A_{3}=\{n\in {\mathbb {N}}_{+}:\;t_{3}(n)=0\}\) then

$$\begin{aligned} n\in A_{3}\Longleftrightarrow 4n+3\in A_{3} \;\text{ and }\;4n+6\in A_{3}. \end{aligned}$$

We have \(t_{3}(0)\ne 0\), \(t_{3}(1)\ne 0\) and \(t_{3}(2)=0\) and thus

$$\begin{aligned} A_{3}=\{2,11,14,47,50,59,72,191, 194, 203,\ldots \}. \end{aligned}$$

We prove that \(A_{3}=A_{3}'\), where \(A_{3}':=\{a_{1}, a_{2}, a_{3}, \ldots \}\), where \(a_{0}=-1\) and for \(k\ge 1\) we have

$$\begin{aligned} a_{2k}=4a_{k}+3,\quad a_{2k+1}=4a_{k}+6. \end{aligned}$$

From the equalities given in (12) and the fact that \(a_{1}=2\), we get \(a_{k}\in A_{3}\). Let us suppose that \(A_{3}\ne \{a_{1},a_{2},\ldots \}\) and let b be the smallest element of \(A_{3}\) such that \(b\ne a_{k}\) for \(k\in {\mathbb {N}}\). It is clear that \(b>10\). However, this implies that \(b\equiv 2\;\text{ or }\;3\mod 4\). If \(b=4n+2\) then \(0=t_{3}(b)=t_{3}(4n+2)=8t_{3}(n-1)\) and thus, from the minimality of b, we get \(n-1=a_{k}\in A_{3}'\) for some \(k\in {\mathbb {N}}_{+}\). We then have \(b=4(n-1)+6=4a_{k}+6=a_{2k+1}\in A_{3}'\)—a contradiction. Similarly, if \(b=4n+3\) then \(0=t_{3}(b)=t_{3}(4n+3)=8t_{3}(n)\) and thus we get \(n=a_{k}\in A_{3}'\) for some \(k\in {\mathbb {N}}_{+}\). Then \(b=4n+3=4a_{k}+3=a_{2k}\in A_{3}'\)—a contradiction. \(\square \)

The above result has an interesting consequence.

Corollary 3.14

Let us consider the sequence of polynomials \(\mathbf{f}(t)=(f_n(t))_{n\in {\mathbb {N}}}\) defined as the coefficients in the power series expansion of the series \(F_t(x)=F(x)^t\), where \(F(x)=\prod _{n=0}^{\infty } \left( 1-x^{2^n}\right) \). If \(n=a_k\), where the sequence \((a_k)_{k\in {\mathbb {N}}_+}\) is defined in Theorem 3.13, then the polynomial \(\frac{f_n(t)}{t}\) is reducible as a polynomial in \({\mathbb {Q}}[t]\).

Proof

If \(n=a_k\), then \(f_n(3)=f_{a_k}(3)=t_3(a_k)=0\) for each \(k\in {\mathbb {N}}_+\).\(\square \)

We expect that the vanishing of certain terms of the sequence \(\mathbf{t}_{3}\) is an exception and believe that the following is true

Conjecture 3.15

If \(m\in {\mathbb {N}}_{\ge 4}\) then the equation \(t_{m}(n)=0\) has no solution in positive integers.

Now we turn our attention to the behaviour of the sequence \(\mathbf{t}_{2}\) and prove that its values cover the set \({\mathbb {Z}}\setminus \{0\}\). Before we present our result let us also note that the sequence \(\mathbf{t}_{2}\) is known as sequence A106407 in [17] and it is closely related to the sequence of the Stern polynomials \((B_{n}(t))_{n\in {\mathbb {N}}}\) defined by the recurrence relation:

$$\begin{aligned} B_{0}(t)=0,\; B_{1}(t)=1,\quad B_{2n}(t)=tB_{n}(t),\quad B_{2n+1}(t)=B_{n}(t)+B_{n+1}(t). \end{aligned}$$

The Stern polynomials were introduced by Klažar et al. [10]. Arithmetic properties of these polynomials were investigated in [18, 19] and also in [8]. The connection of \(\mathbf{t}_{2}\) with the Stern polynomials is clear: we have

$$\begin{aligned} t_{2}(n)=B_{n+1}(-2). \end{aligned}$$

This is interesting to note that \(B_{n}(2)=n\) and \(\{B_{n}(1):\;n\in {\mathbb {N}}\}={\mathbb {N}}\). Moreover, the Stern sequence, i.e., the sequence \((B_{n}(1))_{n\in {\mathbb {N}}_{+}}\), can be also used to enumerate the positive rational numbers. More precisely, the values of the sequence \((B_{n+1}(1)/B_{n}(1))_{n\in {\mathbb {N}}_{+}}\) cover \({\mathbb {Q}}_{+}\) without repetitions.

We will show that \(B_{n+1}(-2)=t_{2}(n)\) has a similar property.

First, we show that if \(t_{2}(n)=k\) has a solution then there are infinitely many solutions.

Lemma 3.16

Let m be a positive integer \(m \ge 3\). Then the following equalities hold

$$\begin{aligned} \begin{array}{llllll} t_2(8n+4) &{}= t_2(2^mn+4), \quad t_2(8n+6) = t_2(2^mn+6), \\ t_2(8n) &{}=t_2(2^mn+2^m-8),\quad t_2(8n+2) = t_2(2^mn+2^m-6), \end{array} \end{aligned}$$

for each positive integer n.

Proof

We prove the first equality. We have

$$\begin{aligned} t_2(2^mn+4)&= t_2(2^{m-1}n+2)+t_2(2^{m-1}n+1) \\&= t_2(2^{m-2}n+1) + t_2(2^{m-2}n)-2t_2(2^{m-2}n) \\&= -2t_2(2^{m-3}n) -t_2(2^{m-3}n)-t_2(2^{m-3}n-1) \\&= -3t_2(2^{m-3}n)-t_2(2^{m-3}n-1) \\&= -3(t_2(2^{m-4}n+t_2(2^{m-4}n-1))+2t_2(2^{m-4}n-1) \\&= -3t_2(2^{m-4}n)-t_2(2^{m-4}n-1) \\&= \ldots \\&= -3t_2(n)-t_2(n-1).\\ \end{aligned}$$

Thus the value of \(t_2(2^mn+4)\) does not depend on m, and our equality holds. One can prove the other equalities in the same manner.\(\square \)

Theorem 3.17

For each \(k\in {\mathbb {N}}_{+}\) the equation \(t_{2}(n)=k\) has infinitely many solutions in positive integers (Fig. 1).

Fig. 1
figure 1

Binary tree rooted in \((2,-1)\)

Proof

Let us consider the sequence of rational numbers \(\left( \frac{t_2(n+1)}{t_2(n)}\right) _{n\in {\mathbb {N}}}\). We prove that for each pair of co-prime positive integers xy where x is odd and y is even one of the fractions \(\frac{x}{y}, \frac{y}{x}, -\frac{y}{x}, - \frac{x}{y}\) is in our sequence. This is a generalisation of the well-known property of Stern diatomic sequence observed by Calkin and Wilf [4].

Let us consider the following four infinite binary trees of pairs of integers. In the root we put one of the pairs \((2, -1)\), \((-2, 1)\), \((1,-2)\), \((-1,2)\). In the left child of (xy) we put \((x+y,-2y)\) and in the right child we put \((-2x,x+y)\). We will prove that each pair of co-prime non-zero integers such that one of them is even is in exactly one of our trees.

Suppose that there is a pair of co-prime non-zero integers (ab) such that one of them is even which is not in one of our trees. Let us choose such pair (ab) with smallest \(|a|+|b|\) and in case of a tie with smallest \(|a+b|\). Without loss of generality \((a,b) = (2x,y)\) (when b is even we proceed in the same way). Let us consider the pair \((-x,x+y)\). Of course \(\gcd (-x,x+y)= \gcd (x,y) = 1\), moreover exactly one of the numbers \(-x,x+y\) is even. We have that \(|-x|+|x+y| \le |x|+|x|+|y| = |2x|+|y|\) and equality holds if and only if x and y have the same sign. In that case \(|2x+y| > |-x + (x+y) | = |y|\). So from our assumptions either \((-x,x+y)\) is in one of our trees or \(x+y=0\). If \(x+y=0\) then \(x= \pm 1, y = \mp 1\) and (2xy) is one of the roots—a contradiction. So \((-x,x+y)\) is in one of our trees but its right child is (2xy), again a contradiction.

Let us observe that the tree with the root \((-a,-b)\) can be obtained from the tree with the root (ab) by multiplying all numbers in tree by \(-1\). Moreover, the tree with root (ab) can be obtained from the tree with root (ba) by swapping the left and right child of each node and swapping the numbers in each pair. We can see that for each valid pair (xy) at least one of the pairs \((x,y),(-x,-y),(y,x),(-y,-x)\) is in the tree rooted in \((-2,1)\). Moreover, from our recurrence relation we get that when we read nodes of that tree row by row from left to right then we get the sequence of pairs \(((t_2(n+1),t_2(n)))_{n=0}^{\infty }\).

Suppose that some odd integer \(-(2n+1)\), for \(n \ne 0,1\), is not contained in our sequence. Let us look at the pair \((-2,2n+1)\); from our observations we get that one of the pairs \((-2,2n+1), (2,-(2n+1)), (2n+1,-2), (-(2n+1),2)\) is contained in the tree rooted at \((-2,1)\). We know that it has to be \((-2, 2n+1)\) or \((2n+1,-2)\) because \(-(2n+1)\) is not a member of our sequence. Let us assume that \((-2,2n+1)\) is in our tree. Then its parent is (1, 2n). The parent of (1, 2n) is \((n+1, -n)\). The second child of \((n+1, -n)\) is \((-2(n+1), 1)\) and one of its children is \((-2n-1, -2)\). We get that \(-(2n+1)\) is one of the terms of our sequence—a contradiction. The second case when \((2n+1,-2)\) is contained in our tree can treated in the same manner.

Therefore for each odd integer k we can find an n such that \(t_2(n) = k\) (Fig. 2). Using now Lemma 3.16, we get the statement of our theorem for odd integers k. As every even number can be written in the form \((-2)^e(2n+1)\), our theorem holds for even integers as well.\(\square \)

Fig. 2
figure 2

The above tree in terms of the sequence \((t_2(n))_{n\in {\mathbb {N}}}\)

Based on numerical computations, we observed a striking symmetry in the set of values of \(t_{2}(n)\). More precisely, we expect that the following is true

Conjecture 3.18

For each \(n\in {\mathbb {N}}\) and \(m=t_{2}(n)\) the following identity holds: \(t_{2}(n')=-t_{2}(n)\), where

$$\begin{aligned} n'=n+(-1)^{\nu _{2}(m)+\frac{m-2^{\nu _{2}(m)}}{2^{\nu _{2}(m)+1}}}2^{\nu _{2}(m)+1}. \end{aligned}$$

The above conjecture is true as was proved by A. Schinzel. The proof is given in the Appendix.

We expect that Theorem 3.17 is an exception and believe that the following is true:

Conjecture 3.19

Let m be a positive integer \(\ge 3\). Then the set of those \(k\in {\mathbb {Z}}\) such that the equation \(t_{m}(n)=k\) has no solution in positive integers is infinite.

3.4 Log-concavity of \(\mathbf{t}_{2}\)

In this subsection we will see that, as in the Prouhet–Thue–Morse sequence, there are no three consecutive terms of the sequence \(\mathbf{t}_{2}\) of the same sign. In order to prove this we will show two interesting inequalities concerning three consecutive terms of the sequence \(\mathbf{t}_{2}\).

Proposition 3.20

For each \(n\in {\mathbb {N}}_+\) we have \(|t_2(n)|\ge \frac{|t_2(n-1)+t_2(n+1)|}{2}\) with equality for n even.

Proof

The statement of the lemma is true for \(n=1\). Assume now that the statement is true for some n. We will show that it is also true for \(2n+1\). We have the following equivalences:

$$\begin{aligned}&|t_2(2n+1)|\ge \frac{|t_2(2n)+t_2(2n+2)|}{2}\\ \Longleftrightarrow&2|t_2(n)|\ge \frac{|t_2(n-1)+2t_2(n)+t_2(n+1)|}{2}\\ \Longleftrightarrow&4t_2(n)^2\ge \frac{\left( t_2(n-1)+t_2(n+1)\right) ^2+4t_2(n)^2+4t_2(n)\left( t_2(n-1)+t_2(n+1)\right) }{4}\\ \Longleftrightarrow&3t_2(n)^2\ge \frac{\left( t_2(n-1)+t_2(n+1)\right) ^2}{4}+t_2(n)\left( t_2(n-1)+t_2(n+1)\right) \end{aligned}$$

By the induction hypothesis \(|t_2(n)|\ge \frac{|t_2(n-1)+t_2(n+1)|}{2}\), thus

$$\begin{aligned} t_2(n)^2\ge \frac{\left( t_2(n-1)+t_2(n+1)\right) ^2}{4} \end{aligned}$$
(13)

and

$$\begin{aligned} 2t_2(n)^2\ge |t_2(n)|\cdot |t_2(n-1)+t_2(n+1)|. \end{aligned}$$
(14)

The last inequality together with the fact that \(t_2(n)\ne 0\) implies that

$$\begin{aligned} 2|t_2(n)|\ge |t_2(n-1)+t_2(n+1)|. \end{aligned}$$

The inequalities (13) and (3.4) imply the last inequality in our equivalences, hence the inequality \(|t_2(2n+1)|\ge \frac{|t_2(2n)+t_2(2n+2)|}{2}\) is true. Now we prove equality \(|t_2(2n)|=\frac{|t_2(2n-1)+t_2(2n+1)|}{2}\). We have

$$\begin{aligned} |t_2(2n)|&=\frac{|t_2(2n-1)+t_2(2n+1)|}{2}\Longleftrightarrow |t_2(n)+t_2(n-1)|\\&=\frac{|-2t_2(n-1)-2t_2(n)|}{2} \end{aligned}$$

and as the second equality is true, the first one holds.\(\square \)

We apply the above result in order to get the following

Theorem 3.21

The sequence \((t_2(n))_{n\in {\mathbb {N}}}\) is log-concave, i.e., for each integer \(n \ge 1\) the following inequality holds

$$\begin{aligned} t_2(n)^2 > t_2(n-1)t_2(n+1). \end{aligned}$$
(15)

The above inequality is optimal in the sense that \(t_2(n)^2 = t_2(n-1)t_2(n+1)+1\) for infinitely many positive integers n

Proof

We present two different proofs of the inequality (15).

First proof. The inequality (15) holds for \(n=1\). Assume now that (15) is true for some \(n\in {\mathbb {N}}_+\). We will show that (15) holds for \(2n+1\). We have the following chain of equivalences:

$$\begin{aligned}&\quad t_2(2n+1)^2>t_2(2n)t_2(2n+2)\\ \Longleftrightarrow&\quad 4t_2(n)^2>\left( t_2(n-1)+t_2(n)\right) \left( t_2(n)+t_2(n+1)\right) \\ \Longleftrightarrow&\quad 4t_2(n)^2>t_2(n-1)t_2(n+1)+t_2(n)^2+t_2(n)\left( t_2(n)+t_2(n+1)\right) \\ \Longleftrightarrow&\quad 3t_2(n)^2>t_2(n-1)t_2(n+1)+t_2(n)\left( t_2(n)+t_2(n+1)\right) . \end{aligned}$$

By the induction hypothesis \(t_2(n)^2 > t_2(n-1)t_2(n+1)\) and by Proposition 3.20 we have \(2t_2(n)^2\ge |t_2(n)|\cdot |t_2(n)+t_2(n+1)|\ge t_2(n)\left( t_2(n)+t_2(n+1)\right) \). These two inequalities imply the last inequality in the above chain of equivalences. We thus obtain the inequality \(t_2(2n+1)^2>t_2(2n)t_2(2n+2)\). Now we prove the inequality \(t_2(2n)^2>t_2(2n-1)t_2(2n+1)\). We have the following equivalences:

$$\begin{aligned}&\quad t_2(2n)^2>t_2(2n-1)t_2(2n+1)\\ \Longleftrightarrow&\quad \left( t_2(n)+t_2(n-1)\right) ^2>4t_2(n-1)t_2(n)\\ \Longleftrightarrow&\quad \left( t_2(n)-t_2(n-1)\right) ^2>0. \end{aligned}$$

The last inequality holds since \(t_2(n)\) and \(t_2(n-1)\) have different parity. Hence we have \(t_2(2n)^2>t_2(2n-1)t_2(2n+1)\).

It remains to prove that \(t_2(n)^2 = t_2(n-1)t_2(n+1)+1\) for infinitely many positive integers n. We will show that this equality holds for \(n=2^k-4\), where k is any positive integer \(\ge 3\). By simple induction we prove that \(t_2(2^k-2)=\frac{1}{3}\left( 1-(-2)^k\right) \) and \(t_2(2^k-1)=(-2)^k\) for any \(k\in {\mathbb {N}}_+\). Finally we compute for \(k\ge 3\):

$$\begin{aligned} t_2\left( 2^k-4\right)&= t_2\left( 2^{k-1}-2\right) +t_2\left( 2^{k-1}-3\right) =t_2\left( 2^{k-2}-1\right) \\&\quad +t_2\left( 2^{k-2}-2\right) -2t_2\left( 2^{k-2}-2\right) \\&= t_2\left( 2^{k-2}-1\right) -t_2\left( 2^{k-2}-2\right) =\frac{1}{3}\left( \left( -2)^k-1\right) \right) ,\\ t_2\left( 2^k-5\right)&= -2t_2\left( 2^{k-1}-3\right) =4t_2\left( 2^{k-2}-2\right) =\frac{1}{3}\left( 4-(-2)^k\right) \\&=1-t_2\left( 2^k-4\right) ,\\ t_2\left( 2^k-3\right)&= -2t_2\left( 2^{k-1}-2\right) =\frac{1}{3}\left( -2-(-2)^k\right) =-1-t_2\left( 2^k-4\right) . \end{aligned}$$

We thus obtain \(t_2(2^k-5)t_2(2^k-3)=t_2(2^k-4)^2-1\) and our theorem follows.

Second proof of the inequality (15). Let us define \(a(n) = t_2(n-1)\). The sequence a(n) satisfies the following recurrence relations \(a(1) = 1\), \(a(2n) = -2a(n)\), and \(a(2n+1) = a(n+1) + a(n)\). It is enough to prove our inequality for the sequence a(n).

Let \(n=2^k(2l+1)\) and \(l \ge 1\). Applying the recurrence relations \(k+1\) times we get

$$\begin{aligned} a(n)&= (-2)^k (a(l) + a(l+1)), \\ a(n-1)&= \left( b(k)-2 \right) a(l) + b(k) a(l+1), \\ a(n+1)&= \left( b(k)-2 \right) a(l+1) + b(k)a(l), \end{aligned}$$

where \(b(k) = -1/3 \cdot \left( (-2)^k-1\right) \). We compute:

$$\begin{aligned} a(n)^2-a(n-1)a(n+1)&= \left( 2^{2k}-b(k)(b(k)-2)\right) \left( a(l)^2+a(l+1)^2\right) \\&\quad + \left( 2^{2k+1} - b(k)^2-(b(k)-2)^2\right) a(l)a(l+1) \end{aligned}$$

and observe that it is enough to prove that \( 2(2^{2k}-b(k)(b(k)-2)) \ge \left| (2^{2k+1} - b(k)^2\right. \left. -(b(k)-2)^2)\right| \). It is not hard to see that the last term is positive when \(k>0\) because \(|b(k)| \le \frac{1}{3} (2^k+1)\). Let us compute the difference

$$\begin{aligned} 2\left( 2^{2k}-b(k)\left( b(k)-2\right) \right) - \left( 2^{2k+1} - b(k)^2-\left( b(k)-2\right) ^2\right) = 4. \end{aligned}$$

When \(k=0\) we get \(a(n)^2-a(n-1)a(n+1) = (a(l+1)-a(l))^2 > 0\). It cannot be zero because a(l) and \(a(l+1)\) have different parity. Therefore our inequality holds.

Finally, let \(n=2^k\). It is easy to see that \((a(n-1),a(n),a(n+1)) = (b(k),(-2)^k,b(k)-2)\). Moreover,

$$\begin{aligned}&a(n)^2-a(n+1)a(n-1)\\&\quad = 2^{2k}-(b(k)-2)b(k) \ge 2^{2k} - 1/9 \left( 2^k+1\right) \left( 2^k+3\right) \\&\quad = 1/9\left( 2^{2k+3}-2^{k+2}-3\right) > 0 \end{aligned}$$

and our theorem follows. \(\square \)

We are ready to prove that none of three consecutive terms of the sequence \((t_2(n))_{n\in {\mathbb {N}}}\) have the same sign. Let us note that the same property holds for \(\mathbf{t}_{1}\)—the Prouhet–Thue–Morse sequence.

Theorem 3.22

For any positive integer n the numbers \(t_2(n-1)\), \(t_2(n)\), \(t_2(n+1)\) do not have the same sign.

Proof

The statement of our theorem is true for \(n=1\). Assume that \(t_2(n-1)\), \(t_2(n)\), \(t_2(n+1)\) do not have the same sign and consider the numbers \(t_2(2n-1)\), \(t_2(2n)\), \(t_2(2n+1)\). If \(t_2(2n-1)\) and \(t_2(2n+1)\) have the same sign then \(t_2(n-1)\) and \(t_2(n)\) have the same sign, since \(t_2(2n-1)=-2t_2(n-1)\) and \(t_2(2n+1)=-2t_2(n)\). However, the sign of \(t_2(2n-1)\) and \(t_2(2n+1)\) is different from the sign of \(t_2(n-1)\) and \(t_2(n)\) while the sign of \(t_2(2n)=t_2(n-1)+t_2(n)\) is the same as the sign of \(t_2(n-1)\) and \(t_2(n)\). Consider now the numbers \(t_2(2n)\), \(t_2(2n+1)\), \(t_2(2n+2)\) and suppose that they have the same sign. Then \(\text{ sgn } t_2(n)=\text{ sgn } \left( -\frac{1}{2}t_2(2n+1)\right) =-\text{ sgn } t_2(2n)\). Since \(t_2(2n)=t_2(n-1)+t_2(n)\) and \(\text{ sgn } t_2(2n)=\text{ sgn } t_2(2n+1)\), thus \(\text{ sgn } t_2(n-1)=-\text{ sgn } t_2(n)\) and \(|t_2(n-1)|>|t_2(n)|\). Analogously we conclude that \(\text{ sgn } t_2(n+1)=-\text{ sgn } t_2(n)\) and \(|t_2(n+1)|>|t_2(n)|\). Thus \(t_2(n)^2<t_2(n-1)t_2(n+1)\), which contradicts the inequality (15). \(\square \)

4 Arithmetic properties of the sequence \((f(n,t))_{n\in {\mathbb {N}}}\) with \(t\in {\mathbb {Z}}_{<0}\)

In this section we consider the sequence \((f_{n}(t))_{n\in {\mathbb {N}}}\) with a fixed negative integer t. We thus put \(t=-m\) for \(m\in {\mathbb {N}}_{+}\) and we write

$$\begin{aligned} b_{m}(n):=f_{n}(-m). \end{aligned}$$

Moreover, in order to shorten the notation we write

$$\begin{aligned} H_{m}(x):=F_{-m}(x)=\sum _{n=0}^{\infty }b_{m}(n)x^{n}. \end{aligned}$$

In particular \(b_{1}(n)=b(n)\) is the well known binary partition function introduced by Euler and studied by Churchhouse [5], Rødseth [16], Gupta [9] and others. It is sequence A018819 in [17]. Also the sequence \((b(2n))_{n\in {\mathbb {N}}}\) can be found in [17], namely as sequence A000123. It is clear that \(b_{m}(n)\) is the convolution of m copies of the sequence \((b(n))_{n\in {\mathbb {N}}}\). We thus have

$$\begin{aligned} b_{m}(n)=\sum _{i_{1}+i_{2}+\dots +i_{m}=n}\prod _{k=1}^{m}b(i_{k}). \end{aligned}$$

From the above expression we easily deduce that the number \(b_{m}(n)\) has a natural combinatorial interpretation. Indeed, \(b_{m}(n)\) counts the number of representations of the integer n as the sum of powers of 2, where each summand can have one of m colors.

We start with the proof of the recurrence relations satisfied by the sequence \((b_{m}(n))_{n\in {\mathbb {N}}}\).

Lemma 4.1

Let m be a positive integer. Then the sequence \((b_{m}(n))_{n\in {\mathbb {N}}}\) satisfies \(b_{m}(0)=1, b_{m}(1)=m\) and for \(n\ge 1\) we have

$$\begin{aligned} b_{m}(2n) =&\sum _{j=0}^{m-1}{m\atopwithdelims ()j+1}(-1)^{j}b_{m}(2n-j-1)+b_{m}(n),\\ b_{m}(2n+1)=&\sum _{j=0}^{m-1}{m\atopwithdelims ()j+1}(-1)^{j}b_{m}(2n-j). \end{aligned}$$

Moreover, the sequence \((b_{m}(n))_{n\in {\mathbb {N}}}\) satisfies the following recurrence relations:

$$\begin{aligned} b_{m}(2n) =&\sum _{j=0}^{n}{2(n-j)+m-1\atopwithdelims ()m-1}b_{m}(j),\\ b_{m}(2n+1)=&\sum _{j=0}^{n}{2(n-j)+m\atopwithdelims ()m-1}b_{m}(j). \end{aligned}$$

Proof

The function \(H_{m}\) satisfies the functional equation \((1-x)^{m}H_{m}(x)=H_{m}(x^2)\). In consequence we have

$$\begin{aligned} (1-x)^{m}H_{m}(x)&=\left( \sum _{j=0}^{m}{m\atopwithdelims ()j}(-1)^{j}x^{j}\right) \left( \sum _{n=0}^{\infty }b_{m}(n)x^{n}\right) \\&=\sum _{n=0}^{\infty }\left( \sum _{j=0}^{m}{m\atopwithdelims ()j}(-1)^{j}b_{m}(n-j)\right) x^{n}=\sum _{n=0}^{\infty }b_{m}(n)x^{2n}. \end{aligned}$$

Comparing now the coefficients on both sides of the above identity we get the two equalities:

$$\begin{aligned} \sum _{j=0}^{m}{m\atopwithdelims ()j}(-1)^{j}b_{m}(2n+1-j)=0,\quad \sum _{j=0}^{m}{m\atopwithdelims ()j}(-1)^{j}b_{m}(2n-j)=b_{m}(n). \end{aligned}$$

From the first equality we get the expression for \(b_{m}(2n+1)\). From the second relation we get the expression for \(b_{m}(2n)\). Finally, replacing j by \(j+1\), we get the relations given in the statement of our theorem.

In order to get the second part of our Lemma we use the same technique. From the functional equation for \(H_{m}(x)=(1-x)^{-m}H_{m}(x^2)\) we have

$$\begin{aligned} \sum _{n=0}^{\infty }b_{m}(2n)x^{2n}=\frac{1}{2}(H_{m}(x)+H_{m}(-x)) =\frac{1}{2}\left( \frac{1}{(1-x)^{m}}+\frac{1}{(1+x)^{m}}\right) H_{m}(x^2). \end{aligned}$$

A quick calculation reveals that

$$\begin{aligned} \frac{1}{2}\left( \frac{1}{(1-x)^{m}}+\frac{1}{(1+x)^{m}}\right) =\sum _{n=0}^{\infty }\left( {\begin{array}{c}m+2n-1\\ 2n\end{array}}\right) x^{2n} \end{aligned}$$

and thus (after the substitution \(x\mapsto \sqrt{x}\)) we have

$$\begin{aligned} \sum _{n=0}^{\infty }b_{m}(2n)x^{n}&=\left( \sum _{n=0}^{\infty }\left( {\begin{array}{c}m+2n-1\\ n\end{array}}\right) x^{2n}\right) \left( \sum _{n=0}^{\infty }b_{m}(n)x^{n}\right) \\&=\sum _{n=0}^{\infty }\left( \sum _{j=0}^{n}\left( {\begin{array}{c}m+2(n-j)-1\\ 2(n-j)\end{array}}\right) b_{m}(j) \right) x^{n}. \end{aligned}$$

Comparing now the coefficients on the both sides of the above identity and using the symmetry property of binomial coefficients, we get the first identity given in the statement of our lemma.

Using exactly the same type of reasoning and the identity

$$\begin{aligned} \sum _{n=0}^{\infty }b_{m}(2n+1)x^{2n+1}=\frac{1}{2}(H_{m}(x)-H_{m}(-x)) =\frac{1}{2}\left( \frac{1}{(1-x)^{m}}-\frac{1}{(1+x)^{m}}\right) H_{m}(x^2) \end{aligned}$$

we prove the second identity. We leave the details to the reader. \(\square \)

4.1 Some inequalities involving \(b_{m}(n)\) for \(m=1, 2\)

In the previous section we proved that \(t_2(n)^2-t_2(n-1)t_2(n+1)>0\). Using recurrence relations for the numbers \(b_m(n)\), we can easily compute the sign of the expression \(b_m(n)^2-b_m(n-1)b_m(n+1)\) for \(m\in \{1,2\}\).

Proposition 4.2

For \(n\in {\mathbb {N}}_+\) the following equalities hold:

$$\begin{aligned} b_1(2n)^2-b_1(2n-1)b_1(2n+1)&=b_1(2n)b_1(n),\\ b_1(2n-1)^2-b_1(2n-2)b_1(2n)&=-b_1(2n-2)b_1(n),\\ b_2(2n)^2-b_2(2n-1)b_2(2n+1)&=\left( \sum _{j=0}^n b_2(j)\right) ^2,\\ b_2(2n-1)^2-b_2(2n-2)b_2(2n)&=\left( \sum _{j=0}^n b_2(j)\right) ^2-b_2(2n-2)b_2(n). \end{aligned}$$

In particular, we have

$$\begin{aligned} (-1)^n\left( b_m(n)^2-b_m(n-1)b_m(n+1)\right) >0 \end{aligned}$$

for \(m=1\) and each \(n\in {\mathbb {N}}_+\).

Proof

We perform direct calculations using the first part of Lemma 4.1. If \(m=1\) then \(b_1(2n)=b_1(2n+1)\) for each \(n\in {\mathbb {N}}\). We thus have

$$\begin{aligned} b_1(2n)^2-b_1(2n-1)b_1(2n+1)&=b_1(2n)^2-b_1(2n-2)b_1(2n)\\&=b_1(2n)\left( b_1(2n)-b_1(2n-2)\right) =b_{1}(2n)b_{1}(n).\\ \end{aligned}$$

Similarly,

$$\begin{aligned} b_1(2n-1)^2-b_1(2n-2)b_1(2n)&=b_1(2n-2)^2-b_1(2n-2)b_1(2n)\\&=b_1(2n-2)\left( b_1(2n-2)-b_1(2n)\right) \\&=-b_1(2n-2)b_1(n). \end{aligned}$$

For \(m=2\) the computations are more complicated:

$$\begin{aligned}&b_2(2n)^2-b_2(2n-1)b_2(2n+1)\\&\quad =\left( \sum _{j=0}^n \left( 2(n-j)+1\right) b_2(j)\right) ^2- \left( \sum _{j=0}^n2(n-j)b_2(j)\right) \\&\quad \quad \times \left( \sum _{j=0}^n\left( 2(n-j)+2\right) b_2(j)\right) \\&\quad = \left( \sum _{j=0}^n \left[ \left( 2(n-j)+1\right) ^2-2(n-j)\left( 2(n-j)+2\right) \right] b_2(j)^2\right) \\&\quad \quad + \left( \sum _{0\le j<k\le n} F(2(n-j)+1,2(n-k)+1)b_2(j)b_2(k)\right) \\&\quad = \left( \sum _{j=0}^n b_2(j)^2\right) +\left( \sum _{0\le j<k\le n} 2b_2(j)b_2(k)\right) =\left( \sum _{j=0}^n b_2(j)\right) ^2. \end{aligned}$$

In the equality between the third and fourth expression in the computation above we applied the identity \(F(x,y)=2xy-(x-1)(y+1)-(x+1)(y-1)=2\) for \(x=2(n-j)+1\) and \(y=2(n-k)+1\).

Remark 4.3

The first to prove the first equality in Proposition 4.2, was D. Knuth, as was pointed out by Reznick in [15].

We also have the identity:

$$\begin{aligned} b_2(2n-1)^2-b_2(2n-2)b_2(2n)=\left( \sum _{j=0}^{n-1} b_2(j)\right) ^2-b_2(2n-2)b_2(n). \end{aligned}$$

Indeed, we have the following chain of inequalities:

$$\begin{aligned} b_2&(2n-1)^2-b_2(2n-2)b_2(2n)\\&=\left( \sum _{j=0}^{n-1} 2(n-j)b_2(j)\right) ^2-\left( \sum _{j=0}^{n-1} \left( 2(n-j)-1\right) b_2(j)\right) \left( \sum _{j=0}^n \left( 2(n-j)+1\right) b_2(j)\right) \\&= \left( \sum _{j=0}^{n-1} \left[ \left( 2(n-j)\right) ^2-\left( 2(n-j)-1\right) \left( 2(n-j)+1\right) \right] b_2(j)^2\right) \\&\quad +\, \left( \sum _{0\le j<k\le n-1} G(2(n-j)+1,2(n-k)+1)b_2(j)b_2(k)\right) -\left( \sum _{j=0}^{n-1} \left( 2(n-j)-1\right) b_2(j)\right) b_2(n)\\&= \left( \sum _{j=0}^{n-1} b_2(j)^2\right) +\left( \sum _{0\le j<k\le n-1}2b_2(j)b_2(k)\right) -b_2(2n-2)b_2(n)=\left( \sum _{j=0}^{n-1} b_2(j)\right) ^2\\&\quad -\,b_2(2n-2)b_2(n). \end{aligned}$$

In the equality between third and fourth expression in the computation above we applied the identity \(G(x,y)=2xy-(x-1)(y+1)-(x+1)(y-1)=2\) for \(x=2(n-j)\) and \(y=2(n-k)\).\(\square \)

It seems that in this case \(b_2(2n-1)^2-b_2(2n-2)b_2(2n)<0\) for all \(n\in {\mathbb {N}}_+\), but we were unable to prove this statement.

4.2 Some congruences involving \(\mathbf{b}_{m}\)

In this subsection we present several congruences involving the sequence \(\mathbf{b}_{m}\) for various values of m. We are mainly interested in the congruences \(\pmod {2^k}\) for various values of k. In particular we give a precise description of the 2-adic valuation of the elements of the sequence \(\mathbf{b}_{2^{k}-1}\) for \(k\in {\mathbb {N}}_{+}\), thereby generalizing the result of Churchhouse.

First we prove a simple lemma concerning the characterization of parity of the number \(b_{m}(n)\).

Lemma 4.4

Let \(m\in {\mathbb {N}}_{+}\) be fixed and write \(m=2^{k}(2u+1)\) with \(k\in {\mathbb {N}}\). Then:

  1. (1)

    We have \(b_{m}(n) \equiv \left( {\begin{array}{c}m\\ n\end{array}}\right) +2^{k+1}\left( {\begin{array}{c}m-2\\ n-2\end{array}}\right) \pmod {2^{k+2}}\) for m even;

  2. (2)

    We have \(b_{m}(n) \equiv \left( {\begin{array}{c}m\\ n\end{array}}\right) \pmod {2}\) for m odd;

  3. (3)

    For infinitely many n we have \(b_{m}(n)\not \equiv 0\pmod {4}\) for m odd.

Proof

To prove the first part, we write \(m = 2^k(2u+1)\). Let us observe that for \(i=0,1,\ldots ,2^{k-1}-1\) we have (by Legendre’s formula for the 2-adic valuation of a factorial) \(v_2(\left( {\begin{array}{c}2^k\\ 2i+1\end{array}}\right) ) = s_2(2i+1)+s_2(2^k-(2i+1))-1 = k\). Thus the following congruence holds

$$\begin{aligned} (1+x)^{2^k}-(1-x)^{2^k}= & {} 2\sum _{i=0}^{2^{k-1}-1} \left( {\begin{array}{c}2^k\\ 2i+1\end{array}}\right) x^{2i+1} \equiv 2^{k+1} \sum _{i=0}^{2^{k-1}-1} x^{2i+1}\\\equiv & {} 2^{k+1}x(1+x)^{2^k-2} \pmod {2^{k+2}}. \end{aligned}$$

Using simple calculations we get the following equality:

$$\begin{aligned} H_{m}(x)&= \prod _{n=0}^{\infty }\left( 1-x^{2^{n}}\right) ^{-m} \\&\equiv \prod _{n=0}^{\infty } \left( ((1+x^{2^n})^{2^k}+2^{k+1}x^{2^n}(x+1)^{2^n(2^k-2)}) \right) ^{-(2u+1)} \\&\equiv \prod _{n=0}^{\infty } \left( (1+x^{2^n})^m+2^{k+1}x^{2^n}(1+x)^{2^n(m-2)} \right) ^{-1} \\&\equiv \prod _{n=0}^{\infty } \left( (1+x^{2^n})^m(1+2^{k+1} \frac{x^{2^n}}{(1+x)^{2^{n+1}}} )\right) ^{-1} \\&\equiv (1-x)^m \left( 1+2^{k+1} \sum _{n=0}^{\infty } \frac{x^{2^n}}{(1+x)^{2^{n+1}}} \right) ^{-1} \\&\equiv (1-x)^m \left( 1+2^{k+1} \frac{x}{1-x}\right) \\&\equiv (1-x)^m +2^{k+1}x(1-x)^{m-1} \\&\equiv (1+x)^m +2^{k+1}x((1+x)^{m-1}+(1+x)^{m-2}) \\&\equiv (1+x)^m+2^{k+1}x^2(1+x)^{m-2} \pmod {2^{k+2}}, \end{aligned}$$

and comparing the coefficients of \(x^{n}\) on both sides of the above congruence we get the result.

For the second part; let us observe that

$$\begin{aligned} H_m(x) = \prod _{n=0}^{\infty }\left( 1-x^{2^{n}}\right) ^{-m} \equiv \prod _{n=0}^{\infty }\left( 1+x^{2^{n}}\right) ^{-m} \equiv (1+x)^m \pmod 2. \end{aligned}$$

For the third part; let us observe that \((1+x)\equiv (1-x)+2x \pmod 4\). Using analogous computations as before we get

$$\begin{aligned} H_m(x) \equiv (1-x)^m\left( 1+2\sum _{n=0}^{\infty } \frac{x^{2^n}}{1+x^{2^n}}\right) \pmod 4. \end{aligned}$$

We let A denote the set of those \(u \in \mathbb {N}_+\) which end with even number of zeros in binary expansion. We have

$$\begin{aligned} \sum _{n=0}^{\infty } \frac{x^{2^n}}{1+x^{2^n}} \equiv \sum _{n=0}^{\infty } \sum _{m=1}^{\infty } x^{m2^n} \equiv \sum _{n \in A} x^n := \xi (x) \pmod 2. \end{aligned}$$

If we had \(b_{m}(n)\equiv 0\pmod 4\) for n large enough, then \((1+x)^m\xi (x)\) would be a polynomial in \(\mathbb {F}_2[[x]]\). But this is impossible, since \(\xi \) satisfies the formula \(\xi +\xi ^2 = \frac{x}{1+x}\) (in \({\mathbb {F}}_2[[x]]\)). \(\square \)

In the sequel we will also need the following simple observations concerning the binomial coefficients modulo 2 and 8.

Lemma 4.5

Let m be a positive integer \(\ge 2\). Then

$$\begin{aligned} {2^{m}-1\atopwithdelims ()k}\equiv 1\pmod {2},\quad \text{ for }\quad k=0,1,\ldots , 2^{m}-1, \end{aligned}$$

and

$$\begin{aligned} {2^{m}\atopwithdelims ()k}\equiv \left\{ \begin{array}{ll} 1 &{}\quad \text{ for }\;k=0, 2^{m} \\ 4 &{} \quad \text{ for }\;k=2^{m-2}, 3\cdot 2^{m-2} \\ 6 &{} \quad \text{ for }\;k=2^{m-1} \\ 0 &{} \quad \text{ in } \text{ the } \text{ remaining } \text{ cases } \end{array} \right\} \pmod {8},\quad \text{ for }\quad k=0,1,\ldots , 2^{m}. \end{aligned}$$

Proof

For each \(j\in \{1,\dots ,2^m-1\}\) we have \(\nu _2(2^m-j)=\nu _2(j)\). Hence \(\nu _2((2^m-1)\cdot \ldots \cdot (2^m-k))=\nu _2(k!)\) for \(k\in \{1,\dots ,2^m-1\}\). We thus have

$$\begin{aligned} \nu _2\left( 2^m-1\atopwithdelims ()k\right) =\nu _2\left( \frac{(2^m-1)\cdot \ldots \cdot (2^m-k)}{k!}\right) =0, \end{aligned}$$

which means that \(2^m-1\atopwithdelims ()k\) is odd.

Obviously, \({2^m\atopwithdelims ()0}={2^m\atopwithdelims ()2^m}=1\).

We have

$$\begin{aligned} {2^m\atopwithdelims ()2^{m-2}}= & {} {2^m\atopwithdelims ()3\cdot 2^{m-2}}=\frac{2^m\cdot \ldots \cdot (3\cdot 2^{m{-}2}{+}1)}{2^{m-2}!}{=}4 \frac{(2^m-1)\cdot \ldots \cdot (3\cdot 2^{m-2}+1)}{(2^{m-2}-1)!}\\= & {} 4{2^m-1\atopwithdelims ()2^{m-2}-1}. \end{aligned}$$

Since \(2^m-1\atopwithdelims ()2^{m-2}-1\) is odd, thus \({2^m\atopwithdelims ()2^{m-2}}={2^m\atopwithdelims ()3\cdot 2^{m-2}}\equiv 4\pmod {8}\).

Let us write \({2^m\atopwithdelims ()2^{m-1}}=\prod _{j=1}^{2^{m-1}} \frac{2^{m-1}+j}{j}\). Each \(j\in \{1,\dots ,2^{m-1}\}\) can be written in the form \(j=2^{k}i\) for some \(k,i\in {\mathbb {N}}\), where i is an odd number. If \(k\le m-4\) then

$$\begin{aligned} \frac{2^{m-1}+j}{j}=\frac{2^{m-1}+2^ki}{2^ki}=\frac{2^{m-k-1}+i}{i}\equiv 1\pmod {8}. \end{aligned}$$

We thus obtain

$$\begin{aligned} {2^m\atopwithdelims ()2^{m-1}}= & {} \prod _{j=1}^{2^{m-1}} \frac{2^{m-1}+j}{j}\equiv \frac{5\cdot 2^{m-3}}{2^{m-3}}\cdot \frac{3\cdot 2^{m-2}}{2^{m-2}}\cdot \frac{7\cdot 2^{m-3}}{3\cdot 2^{m-3}}\cdot \frac{2^m}{2^{m-1}}\\= & {} 5\cdot 3\cdot \frac{7}{3}\cdot 2\equiv 6\pmod {8}. \end{aligned}$$

If \(\nu _2(k)\le m-3\) then

$$\begin{aligned} {2^m\atopwithdelims ()k}= & {} \frac{2^m\cdot \ldots \cdot (2^m-k+1)}{k!}=\frac{2^m}{k}\cdot \frac{(2^m-1)\cdot \ldots \cdot (2^m-k+1)}{(k-1)!}\\= & {} \frac{2^m}{k}\cdot {2^m-1\atopwithdelims ()k-1}\equiv 0\pmod {8} \end{aligned}$$

and our lemma follows. \(\square \)

One of the main results of this paper is the following result concerning the computation of the 2-adic valuation of the members of the sequence \((b_{2^{k}-1}(n))_{n\in {\mathbb {N}}}\) with fixed positive integer k. Our next theorem can be seen as a generalization of the identity

$$\begin{aligned} \nu _{2}(b_{1}(n))= {\left\{ \begin{array}{ll} \frac{1}{2}|t_{n}-2t_{n-1}+t_{n-2}|,&{} \text{ if }\;n\ge 2\\ 0,&{} \text{ if }\;n\in \{0,1\} \end{array}\right. } \end{aligned}$$

obtained by Churchhouse (however, in a slightly different form). Here, \(t_{n}\) is the n-th term of the Prouhet–Thue–Morse sequence.

Theorem 4.6

Let \(k\in {\mathbb {N}}_{+}\) be given. We then have the following equality

$$\begin{aligned}&\nu _{2}\left( b_{2^{k}-1}\left( 2^{k+2}n+i\right) \right) \nonumber \\&={\left\{ \begin{array}{ll} \begin{array}{ll} \nu _{2}\left( b_{2^{k}-1}\left( 2^{k+2}n\right) \right) =\nu _{2}(b_{1}(8n)), &{} \quad \text{ for }\quad i=0,1,\ldots , 2^{k}-1, \\ 1, &{} \quad \text{ for }\quad i=2^{k}, 2^{k}+1,\ldots , 2^{k+1}-1, \\ 2, &{} \quad \text{ for }\quad i=2^{k+1}, 2^{k+1}+1,\ldots , 3\cdot 2^{k}-1, \\ 1, &{} \quad \text{ for }\quad i=3\cdot 2^{k}, 3\cdot 2^{k}+1,\ldots , 2^{k+2}-1, \end{array} \end{array}\right. } \end{aligned}$$

for \(n\in {\mathbb {N}}\). In particular \(\nu _{2}(b_{2^{k}-1}(n))\in \{0,1,2\}\) and \(\nu _{2}(b_{2^k-1}(n))=0\) if and only if \(n\le 2^{k}-1\).

Proof

First of all, let us observe that the second part of Lemma 4.4 and the first part of Lemma 4.5 implies that \(b_{2^{k}-1}(n)\) is odd for \(n\le 2^{k}-1\) and thus \(\nu _{2}(b_{2^{k}-1}(n))=0\) in this case.

Let us observe that from the identity \(H_{2^{k}-1}(x)=F_{1}(x)H_{2^{k}}(x)\) we get the identity

$$\begin{aligned} b_{2^{k}-1}(n)=\sum _{j=0}^{n}t_{n-j}b_{2^{k}}(j), \end{aligned}$$
(16)

where \(t_{n}=t_{1}(n)=(-1)^{s_{2}(n)}\) is n-th term of the Prouhet–Thue–Morse sequence. Now let us observe that from the first part of Lemma 4.4 and the second part of Lemma 4.5 we have

$$\begin{aligned} b_{2^{k}}(n)\equiv {2^{k}\atopwithdelims ()n}\pmod {8} \end{aligned}$$

for \(n=0,1,\ldots ,2^{k}\) and \(b_{2^{k}}(n)\equiv 0\pmod {8}\) for \(n>2^{k}\), provided \(k\ge 2\) or \(n\ne 2\). Moreover,

$$\begin{aligned} b_2(2)\equiv {2\atopwithdelims ()2}+4{0\atopwithdelims ()0}=5\pmod {8}. \end{aligned}$$

Summing up this discussion we have the following expression for \(b_{2^{k}-1}(n)\pmod {8}\), where \(k\ge 2\) and \(n\ge 2^{k}\):

$$\begin{aligned} b_{2^{k}-1}(n)&=\sum _{j=0}^{n}t_{n-j}b_{2^{k}}(j)\\&=\sum _{j=0}^{2^{k}}t_{n-j}b_{2^{k}}(j)+\sum _{j=2^{k}+1}^{n}t_{n-j}b_{2^{k}}(j)\\&\equiv \sum _{j=0}^{2^{k}}t_{n-j}b_{2^{k}}(j)\pmod {8}\\&\equiv \sum _{j=0}^{2^{k}}t_{n-j}{2^{k}\atopwithdelims ()j}\pmod {8}\\&\equiv t_{n}+t_{n-2^{k}}+4t_{n-2^{k-2}}+4t_{n-3\cdot 2^{k-2}}+6t_{n-2^{k-1}}\pmod {8}. \end{aligned}$$

However, it is clear that \(t_{n-2^{k-2}}+t_{n-3\cdot 2^{k-2}}\equiv 0\pmod {2}\) and thus we can simplify the above expression and get

$$\begin{aligned} b_{2^{k}-1}(n)\equiv t_{n}+t_{n-2^{k}}+6t_{n-2^{k-1}}\pmod {8} \end{aligned}$$

for \(n\ge 2^{k}\). If \(k=1\) and \(n\ge 2\) then, analogously, we get

$$\begin{aligned} b_{1}(n)\equiv \sum _{j=0}^{2^{k}}t_{n-j}b_{2^{k}}(j) \quad \equiv t_{n}+5t_{n-2}+2t_{n-1}\pmod {8} \end{aligned}$$

and since \(t_{n-1}\equiv t_{n-2}\pmod {2}\), we thus conclude that

$$\begin{aligned} b_{1}(n)\equiv t_{n}+t_{n-2}+6t_{n-1}\pmod {8}. \end{aligned}$$

Let us put \(R_{k}(n)=t_{n}+t_{n-2^{k}}+6t_{n-2^{k-1}}\). Using now the recurrence relations for \(t_{n}\), i.e., \(t_{2n}=t_{n}, t_{2n+1}=-t_{n}\) we easily deduce the identities

$$\begin{aligned} R_{k}(2n)=R_{k-1}(n),\quad R_{k}(2n+1)=-R_{k-1}(n) \end{aligned}$$

for \(k\ge 2\). Using a simple induction argument, one can easily obtain the following identities:

$$\begin{aligned} |R_{k}\left( 2^{k}m+j\right) |=|R_{1}(2m)| \end{aligned}$$
(17)

for \(k\ge 2, m\in {\mathbb {N}}\) and \(j\in \{0,\dots ,2^{k}-1\}\). From the above identity we easily deduce that \(R_{k}(n)\not \equiv 0\pmod {8}\) for each \(n\in {\mathbb {N}}\) and each \(k\ge 1\). If \(k=1\) then \(R_{1}(n)=t_{n}+6t_{n-1}+t_{n-2}\) and \(R_{1}(n)\equiv 0\pmod {8}\) if and only if \(t_{n}=t_{n-1}=t_{n-2}\). However, a well known property of the Prouhet–Thue–Morse sequence is that there are no three consecutive terms which are equal. If \(k\ge 2\) then our statement about \(R_{k}(n)\) is clearly true for \(n\le 2^{k}\). If \(n>2^{k}\) then we can write \(n=2^{k}m+j\) for some \(m\in {\mathbb {N}}\) and \(j\in \{0,1,\ldots ,2^{k}-1\}\). Using the reduction (17) and the property obtained for \(k=1\), we get the result. Summing up our discussion, we have proved that \(\nu _{2}(b_{2^{k}-1}(n))\le 2\) for each \(n\in {\mathbb {N}}\), since \(\nu _{2}(b_1(n))\in \{0,1,2\}\). Moreover, as an immediate consequence of our reasoning we get the equality

$$\begin{aligned} \nu _{2}\left( b_{2^{k}-1}\left( 2^kn+j\right) \right) =\nu _{2}(b_{1}(2n)) \end{aligned}$$

for \(j\in \{0,\dots ,2^{k}-1\}\). Using the above identity and the properties of \(\nu _{2}(b_{1}(2n))\) we easily get the identities presented in the statement of our theorem. \(\square \)

It is an interesting question whether we can say something non-trivial about 2-adic valuation of the number \(b_{m}(n)\) for \(m\ne 2^{k}-1\). In order to do this in the sequel we will need the following lemma concerning the form of the generating function of the subsequence \((b_{m}(2^{k}n+i))_{n\in {\mathbb {N}}}\), where \(k\in {\mathbb {N}}\) is given and \(i\in \{0,\ldots , 2^{k}-1\}\). We have the following

Lemma 4.7

Let \(m\in {\mathbb {N}}_{+}\) be fixed. Let \(i,k\in {\mathbb {N}}\) be given and consider the function \(H_{i,k}(x)=H_{i,k,m}(x)\) which is the generating function for the sequence \((b_{m}(2^{k}n+i))_{n\in {\mathbb {N}}}\), where \(0\le i<2^{k}\), i.e., \(H_{i,k}(x)=\sum _{n=0}^{\infty }b_{m}(2^{k}n+i)x^{n}\). Then

$$\begin{aligned} H_{i,k}(x)=\frac{h_{i,k}(x)}{(1-x)^{mk}}H_{m}(x), \end{aligned}$$

where the (double) sequence of polynomials \((h_{i,k}(x))_{k\in {\mathbb {N}}, 0\le i<2^{k}}=(h_{i,k,m}(x))_{k\in {\mathbb {N}}, 0\le i<2^{k}}\) satisfies \(h_{0,0}(x)=1\) and for \(k\in {\mathbb {N}}_{+}\) and \(0\le i<2^{k}\) we have

$$\begin{aligned} h_{i,k}(x)= {\left\{ \begin{array}{ll} \begin{array}{lll} \frac{1}{2}(h_{i,k-1}(\sqrt{x})(1+\sqrt{x})^{mk} \\ +h_{i,k-1}(-\sqrt{x})(1-\sqrt{x})^{mk}), &{} &{} \text{ for }\quad i=0,1,\ldots ,2^{k-1}-1 \\ \frac{1}{2\sqrt{x}}(h_{i-2^{k-1},k-1}(\sqrt{x})(1+\sqrt{x})^{mk} \\ -h_{i-2^{k-1},k-1}(-\sqrt{x})(1-\sqrt{x})^{mk}), &{} &{} \text{ for }\quad i=2^{k-1},\ldots ,2^{k}-1 \end{array} \end{array}\right. }. \end{aligned}$$

Proof

We proceed by induction on k. We have the obvious equality \(h_{0,0}(x)=1\). Let us suppose that our result is true for k. We then have for \(i=0,1,\ldots ,2^{k-1}-1\):

$$\begin{aligned} H_{i,k+1}(x^2)&=\sum _{n=0}^{\infty }b_{m}\left( 2^{k+1}n+i\right) x^{2n}\\&=\sum _{n=0}^{\infty }b_{m}\left( 2^{k}\cdot 2n+i\right) x^{2n}\\&=\frac{1}{2}(H_{i,k}(x)+H_{i,k}(-x))\\&=\frac{1}{2}\left( \frac{h_{i,k}(x)}{(1-x)^{mk}}H_{m}(x)+\frac{h_{i,k}(-x)}{(1+x)^{mk}}H_{m}(-x)\right) \\&=\frac{1}{2}\left( \frac{h_{i,k}(x)}{(1-x)^{mk}}\cdot \frac{1}{(1-x)^{m}} +\frac{h_{i,k}(-x)}{(1+x)^{mk}}\cdot \frac{1}{(1+x)^{m}}\right) H_{m}(x^2)\\&=\frac{1}{2}\left( (1+x)^{m(k+1)}h_{i,k}(x)+(1-x)^{m(k+1)}h_{i,k}(-x)\right) \frac{H_{m}(x^2)}{(1-x^2)^{m(k+1)}}\\&=\frac{h_{i,k+1}(x^2)}{(1-x^2)^{m(k+1)}}H_{m}(x^2). \end{aligned}$$

It is clear that \(\frac{1}{2}\left( (1+x)^{m(k+1)}h_{i,k}(x)+(1-x)^{m(k+1)}h_{i,k}(-x)\right) \) is an even function of x. Comparing now the first and the last expression from the above and replacing x by \(x^{1/2}\), we get the statement of our lemma. If \(i=2^{k-1},\ldots ,2^{k}-1\) then we write \(i=2^k+i'\), where \(i'=0,1,\ldots ,2^{k-1}-1\), and perform analogous calculations.

$$\begin{aligned} H_{i,k+1}(x^2)&=\sum _{n=0}^{\infty }b_{m}\left( 2^{k+1}n+i\right) x^{2n}\\&=\sum _{n=0}^{\infty }b_{m}\left( 2^{k}\cdot 2n+2^k+i'\right) x^{2n}\\&=\frac{1}{x}\sum _{n=0}^{\infty }b_{m}\left( 2^{k}\cdot (2n+1)+i'\right) x^{2n+1}\\&=\frac{1}{2x}(H_{i',k}(x)-H_{i',k}(-x))\\&=\frac{1}{2x}\left( \frac{h_{i',k}(x)}{(1-x)^{mk}}H_{m}(x) -\frac{h_{i',k}(-x)}{(1+x)^{mk}}H_{m}(-x)\right) \\&=\frac{1}{2x}\left( \frac{h_{i',k}(x)}{(1-x)^{mk}}\cdot \frac{1}{(1-x)^{m}} -\frac{h_{i',k}(-x)}{(1+x)^{mk}}\cdot \frac{1}{(1+x)^{m}}\right) H_{m}(x^2)\\&=\frac{1}{2x}\left( (1+x)^{m(k+1)}h_{i',k}(x)-(1-x)^{m(k+1)}h_{i',k}(-x)\right) \frac{H_{m}(x^2)}{(1-x^2)^{m(k+1)}}\\&=\frac{h_{i,k+1}(x^2)}{(1-x^2)^{m(k+1)}}H_{m}(x^2). \end{aligned}$$

Replacing x by \(x^{\frac{1}{2}}\), we get the result. \(\square \)

The above lemma is a useful tool which sometimes allows to get congruences involving the (sub)sequence \((b_{m}(2^{k}n+i))_{n\in {\mathbb {N}}}\). We have the following results concerning the behaviour of \(F_{i,k}(x)\pmod {p}\), where p is a prime number, \(m=p^{s}\) for some \(s\in {\mathbb {N}}_{+}\) and \(k=1,2,3\).

Lemma 4.8

Let p be an odd prime number and \(m=p^{s}\) for some \(s\in {\mathbb {N}}_{+}\).

For \(k=1\) the following congruences hold:

$$\begin{aligned}&h_{0,1}(x)\equiv 1\pmod {p},\\&h_{1,1}(x)\equiv x^{\frac{m-1}{2}}\pmod {p}. \end{aligned}$$

For \(k=2\) the following congruences hold:

$$\begin{aligned}&h_{0,2}(x)\equiv 1+x^{m}\pmod {p},\\&h_{1,2}(x)\equiv {\left\{ \begin{array}{ll} \begin{array}{lll} x^{\frac{m-1}{2}}+x^{\frac{5m-1}{4}}\pmod {p}, &{} &{}\text{ if }\; m\equiv 1\pmod {4} \\ 2x^{\frac{3m-1}{4}}\pmod {p}, &{} &{}\text{ if }\; m\equiv 3\pmod {4} \end{array} \end{array}\right. },\\&h_{2,2}(x)\equiv 2x^{\frac{m-1}{2}}\pmod {p},\\&h_{3,2}(x)\equiv {\left\{ \begin{array}{ll} \begin{array}{lll} 2x^{\frac{3}{4}(m-1)}\pmod {p}, &{} &{} \text{ if }\; m\equiv 1\pmod {4}\\ x^{\frac{m-3}{4}}+x^{\frac{5m-3}{4}}\pmod {p}, &{} &{}\text{ if }\; m\equiv 3\pmod {4} \end{array} \end{array}\right. }. \end{aligned}$$

Proof

Direct calculations give:

$$\begin{aligned} h_{0,1}(x)&=\frac{1}{2}\left( (1+\sqrt{x})^m+(1-\sqrt{x})^m\right) \equiv \frac{1}{2}\left( 1+x^{\frac{m}{2}}+1-x^{\frac{m}{2}}\right) =1\pmod {p},\\ h_{1,1}(x)&=\frac{1}{2\sqrt{x}}\left( (1+\sqrt{x})^m-(1-\sqrt{x})^m\right) \equiv \frac{1}{2\sqrt{x}}\left( 1+x^{\frac{m}{2}}-1+x^{\frac{m}{2}}\right) \\&=x^{\frac{m-1}{2}}\pmod {p},\\ h_{0,2}(x)&=\frac{1}{2}\left( h_{0,1}(\sqrt{x})(1+\sqrt{x})^{2m}+h_{0,1}(-\sqrt{x}) (1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2}\left( (1+\sqrt{x})^{2m}+(1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2}\left( \left( 1+x^{\frac{m}{2}}\right) ^2+\left( 1-x^{\frac{m}{2}}\right) ^2\right) =\frac{1}{2}\left( 1+2x^{\frac{m}{2}}+x^m+1-2x^{\frac{m}{2}}+x^m\right) \\&=1+x^m\pmod {p},\\ h_{2,2}(x)&=\frac{1}{2\sqrt{x}}\left( h_{0,1}(\sqrt{x})(1+\sqrt{x})^{2m}-h_{0,1}(-\sqrt{x})(1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2\sqrt{x}}\left( (1+\sqrt{x})^{2m}-(1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2\sqrt{x}}\left( \left( 1+x^{\frac{m}{2}}\right) ^2-\left( 1-x^{\frac{m}{2}}\right) ^2\right) \\&=\frac{1}{2\sqrt{x}}\left( 1+2x^{\frac{m}{2}}+x^m-1+2x^{\frac{m}{2}}-x^m\right) \\&=2x^{\frac{m-1}{2}}\pmod {p}, \end{aligned}$$
$$\begin{aligned} h_{1,2}(x)&=\frac{1}{2}\left( h_{1,1}(\sqrt{x})(1+\sqrt{x})^{2m}+h_{1,1}(-\sqrt{x})(1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2}\left( x^{\frac{m-1}{4}}(1+\sqrt{x})^{2m}+(-x)^{\frac{m-1}{4}}(1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2}\left( x^{\frac{m-1}{4}}\left( 1+x^{\frac{m}{2}}\right) ^2+(-x)^{\frac{m-1}{4}}\left( 1-x^{\frac{m}{2}}\right) ^2\right) \\&=\frac{1}{2}\left( x^{\frac{m-1}{4}}\left( 1+2x^{\frac{m}{2}}+x^m\right) +(-x)^{\frac{m-1}{4}}\left( 1-2x^{\frac{m}{2}}+x^m\right) \right) \\&= {\left\{ \begin{array}{ll} x^{\frac{m-1}{4}}+x^{\frac{5m-1}{4}} \pmod {p}, &{} \text{ if } m\equiv 1\pmod {4} \\ 2x^{\frac{3m-1}{4}} \pmod {p}, &{} \text{ if } m\equiv 3\pmod {4} \end{array}\right. },\\ h_{3,2}(x)&=\frac{1}{2\sqrt{x}}\left( h_{1,1}(\sqrt{x})(1+\sqrt{x})^{2m}-h_{1,1}(-\sqrt{x})(1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2\sqrt{x}}\left( x^{\frac{m-1}{4}}(1+\sqrt{x})^{2m}-(-x)^{\frac{m-1}{4}}(1-\sqrt{x})^{2m}\right) \\&\equiv \frac{1}{2\sqrt{x}}\left( x^{\frac{m-1}{4}}\left( 1+x^{\frac{m}{2}}\right) ^2-(-x)^{\frac{m-1}{4}}\left( 1-x^{\frac{m}{2}}\right) ^2\right) \\&=\frac{1}{2\sqrt{x}}\left( x^{\frac{m-1}{4}}\left( 1+2x^{\frac{m}{2}}+x^m\right) -(-x)^{\frac{m-1}{4}}\left( 1-2x^{\frac{m}{2}}+x^m\right) \right) \\&={\left\{ \begin{array}{ll} 2x^{\frac{3m-3}{4}} \pmod {p}, &{} \text{ if } m\equiv 1\pmod {4} \\ x^{\frac{m-3}{4}}+x^{\frac{5m-3}{4}} \pmod {p}, &{} \text{ if } m\equiv 3\pmod {4} \end{array}\right. }. \end{aligned}$$

\(\square \)

As a consequence of the above lemma we get the following interesting

Corollary 4.9

Let p be an odd prime number and \(m=p^{s}\) for some \(s\in {\mathbb {N}}_{+}\). Then the following congruences are true:

$$\begin{aligned} b_{m}(2n+i)-b_{m}(2(n-m)+i)\equiv {\left\{ \begin{array}{ll} \begin{array}{lll} b_{m}(n)\pmod {p} &{} &{} \text{ for }\quad i=0 \\ b_{m}\left( n-\frac{m-1}{2}\right) \pmod {p} &{} &{} \text{ for }\quad i=1 \end{array} \end{array}\right. }, \end{aligned}$$
$$\begin{aligned}&b_{m}(4n+i)-2b_{m}(4(n-m)+i)+b_{m}(4(n-2m)+i) \\&\quad \equiv {\left\{ \begin{array}{ll} \begin{array}{lll} b_{m}(n)+b_{m}(n-m) &{} &{} \quad \text{ for }\quad i=0 \\ b_{m}\left( n-\frac{m-1}{4}\right) +b_{m}\left( n-\frac{5m-1}{4}\right) &{} &{}\quad \text{ for }\quad i=1\quad \text{ and }\quad s\equiv 0\pmod {2} \\ 2b_{m}\left( n-\frac{3m-1}{4}\right) &{} &{}\quad \text{ for }\quad i=1\quad \text{ and }\quad s\equiv 1\pmod {2} \\ 2b_{m}\left( n-\frac{m-1}{2}\right) &{} &{} \quad \text{ for }\quad i=2 \\ 2b_{m}\left( n-\frac{3}{4}(m-1)\right) &{} &{} \quad \text{ for }\quad i=3\quad \text{ and }\quad s\equiv 0\pmod {2} \\ b_{m}\left( n-\frac{m-3}{4}\right) +b_{m}\left( n-\frac{5m-3}{4}\right) &{} &{}\quad \text{ for }\quad i=3\quad \text{ and }\quad s\equiv 1\pmod {2} \end{array} \end{array}\right. }\pmod {p}. \end{aligned}$$

Proof

In order to obtain the first congruence it suffices to compare the coefficients of functions \((1-x^m)H_{i,1}(x)\equiv (1-x)^mH_{i,1}(x)\pmod {m}\) and \(h_{i,1}(x)H_m(x)\), which are equivalent modulo m by the previous lemma. For the second one we compare the functions \((1-2x^m+x^{2m})H_{i,2}(x)\equiv (1-x)^{2m}H_{i,2}(x)\pmod {m}\) and \(h_{i,2}(x)H_m(x)\). \(\square \)

Using a different approach we get the following:

Theorem 4.10

Let \(m\in {\mathbb {N}}_{\ge 2}\). Then for \(n\in {\mathbb {N}}\) the following identity holds:

$$\begin{aligned} nb_{m}(n)=m\sum _{i=0}^{n}(n-i)b_{1}(n-i)b_{m-1}(i). \end{aligned}$$

In particular, if \(\gcd (m,n)=1\) then

$$\begin{aligned} b_{m}(n)\equiv 0\pmod {m}. \end{aligned}$$

Proof

We have the following equality: \(xH_{m}'(x)=x(H(x)^{m})'=mxH'(x)(H(x))^{m-1}=mxH'(x)H_{m-1}(x)\). Equivalently:

$$\begin{aligned} \sum _{n=0}^{\infty }nb_{m}(n)x^{n}=m\left( \sum _{n=0}^{\infty }nb_{1} (n)x^{n}\right) \left( \sum _{n=0}^{\infty }b_{m-1}(n)\right) =\sum _{n=0}^{\infty }\left( m\sum _{i=0}^{n}(n-i)b_{1}(n-i)b_{m-1}(i)\right) x^{n}. \end{aligned}$$

Comparing now the coefficients on the both sides of the above identity, we get the first statement of our theorem. The second one is immediate.\(\square \)

Remark 4.11

Let p be an odd prime number and \(m=p^{s}\) for some \(s\in {\mathbb {N}}_{+}\). Let us observe that for each \(n\in {\mathbb {N}}\) the following congruence holds:

$$\begin{aligned} b_{m}((2n+1)m)\equiv b_{m}(2nm)\pmod {p}. \end{aligned}$$
(18)

Indeed, we have

$$\begin{aligned} H_{p^{s}}(x)\equiv H_{1}(x)^{p^{s}}\equiv H_{1}(x^{p^{s}})\pmod {p} \end{aligned}$$

and thus

$$\begin{aligned} b_{p^{s}}(n)\equiv {\left\{ \begin{array}{ll} \begin{array}{lll} 0 &{} \pmod {p} &{} \text{ if }\quad n\not \equiv 0\pmod {p^{s}} \\ b_{1}\left( \frac{n}{p^{s}}\right) &{} \pmod {p} &{} \text{ if }\quad n\equiv 0\pmod {p^{s}} \end{array} \end{array}\right. }. \end{aligned}$$

From the above congruence, we have \(b_{m}(nm)\equiv b_1(n)\pmod {p}\) for \(n\in {\mathbb {N}}\). Since \(b_{1}(2n+1)=b_{1}(2n)\), we obtain (18). Actually, in the same way we can prove that for \(r,s\in {\mathbb {N}}_+\), a prime number p and \(n\in {\mathbb {N}}\) we have

$$\begin{aligned} b_{rp^s}(n)\equiv {\left\{ \begin{array}{ll} 0, &{} \text{ if } n\not \equiv 0\pmod {p^s}\\ b_r(\frac{n}{p^s})\pmod {p}, &{} \text{ if } n\equiv 0\pmod {p^s} \end{array}\right. }. \end{aligned}$$

In particular, if \(m=p_1^{s_1}\cdots p_k^{s_k}\) is the factorization of a given positive integer m, \(n\in {\mathbb {N}}\) and \(p_i^{s_i}\not \mid n\) for each \(i\in \{1,\dots ,k\}\) then \(p_1\cdots p_k\mid b_m(n)\).

Remark 4.12

The method used in the proof of Corollary 4.9 can be also used in order to get some congruences involving sums of certain values of \(b_{m}\) modulo primes p which are co-prime to m. Indeed, the definition of the function \(H_{i,k,m}\) and the corresponding polynomials \(h_{i,k,m}\) guarantees the identity

$$\begin{aligned} (1-x)^{km}\sum _{n=0}^{\infty }b_{m}\left( 2^{k}n+i\right) X^{n}=h_{i,k,m}(x)H_{m}(x) \end{aligned}$$

and the congruence

$$\begin{aligned} (1-x)^{km}\sum _{n=0}^{\infty }b_{m}\left( 2^{k}n+i\right) X^{n}\equiv h_{i,k,m}(x)H_{m}(x)\pmod {p}, \end{aligned}$$

where p is a given prime number. If we are lucky, the reduction \(h_{i,k,m}(x)\pmod {p}\) is simple, i.e., contains far fewer non-zero coefficients \(\pmod {p}\) than the non-reduced polynomial, and we can deduce new congruences with ikm and p satisfying \(\gcd (p,m)=1\). Using this approach, one can find many congruences with few summands and, in fact, there are some instances of ikm and p such that \(h_{i,k,m}(x)\equiv cx^{s}\pmod {p}\) for some \(c\in {\mathbb {Z}}\) and \(s\in {\mathbb {N}}\). In particular we get the following

Theorem 4.13

The following congruences are true:

$$\begin{aligned} \sum _{i=0}^{8}b_{4}(4(n-i)+1)\equiv & {} b_{4}(n)\pmod {3}, \quad n\ge 8, \\ \sum _{i=0}^{4}b_{2}(4(n-i))\equiv & {} b_{2}(n)\pmod {5},\quad n\ge 4, \\ \sum _{i=0}^{4}b_{2}(4(n-i)+2)\equiv & {} b_{2}(n-2)\pmod {5}, \quad n\ge 4. \end{aligned}$$

Proof

The congruences given above are consequences of the following equalities

$$\begin{aligned} h_{1,2,4}(x)&=4(3x+1)\left( 3x^3+27x^2+33x+1\right) \equiv 1\pmod {3},\\ h_{0,2,2}(x)&=5 x^2+10 x+1\equiv 1\pmod {5},\\ h_{2,2,2}(x)&=x^2+10 x+5\equiv x^2\pmod {5} \end{aligned}$$

and the fact that \((1-x)^{8}\equiv \frac{1-x^9}{1-x}\pmod {3}\) and \((1-x)^{4}\equiv \frac{1-x^{5}}{1-x}\pmod {5}\).\(\square \)

It is quite interesting to look at the family of polynomials \((h_{i,k,m}(x))\) as an independent object of study and to ask which members of this family are reducible. It seems that this is a rather difficult question. Based on numerical observations, we state the following

Theorem 4.14

We have

$$\begin{aligned}&h_{2^{k}+1,k+1,2}(x)\equiv 0\pmod {8(x+1)},\quad k\in {\mathbb {N}}_{+},\\&h_{2^{k}+2,k+1,4}(x)\equiv 0\pmod {8(x+1)},\quad k\in {\mathbb {N}}_{\ge 2}. \end{aligned}$$

In order to prove the above theorem, we will show three lemmas.

Lemma 4.15

For every \(n,j\in {\mathbb {N}}\) we have \(4\mid {4n\atopwithdelims ()2j}-{2n\atopwithdelims ()j}\).

Proof

We write

$$\begin{aligned} {4n\atopwithdelims ()2j}-{2n\atopwithdelims ()j}&={2n\atopwithdelims ()j}\left( \frac{(4n-1)(4n-3)\cdots (4n-2j+1)}{1\cdot 3\cdots (2j-1)}-1\right) \\&={2n\atopwithdelims ()j}\frac{(4n-1)(4n-3)\cdots (4n-2j+1)-1\cdot 3\cdots (2j-1)}{1\cdot 3\cdots (2j-1)}. \end{aligned}$$

The factor \((4n-1)(4n-3)\cdots (4n-2j+1)-1\cdot 3\cdots (2j-1)\) is even, since numbers \((4n-1)(4n-3)\cdots (4n-2j+1)\) and \(1\cdot 3\cdots (2j-1)\) are odd. If j is even then the products \((4n-1)(4n-3)\cdots (4n-2j+1)\) and \(1\cdot 3\cdots (2j-1)\) have the same number of factors congruent to 3 modulo 4, hence they are congruent modulo 4 and their difference is divisible by 4. If j is odd then

$$\begin{aligned} \nu _2\left( 2n\atopwithdelims ()j\right) =\nu _2\left( \frac{2n}{j}{2n-1\atopwithdelims ()j-1}\right) \ge 1. \end{aligned}$$

Thus the numbers \(2n\atopwithdelims ()j\) and \((4n-1)(4n-3)\cdots (4n-2j+1)-1\cdot 3\cdots (2j-1)\) are even which implies that \(4\mid {4n\atopwithdelims ()2j}-{2n\atopwithdelims ()j}\).\(\square \)

The lemma given below is well known and we omit of its proof.

Lemma 4.16

We will call a polynomial \(P(x)=\sum _{j=s}^d c_jx^j\in {\mathbb {Z}}[x]\), \(c_s,c_d\ne 0\), palindromic, if \(c_{d-j}=c_{s+j}\) for each \(j\in \{0,1,\dots ,d-s\}\). Each palindromic polynomial \(P\in {\mathbb {Z}}[x]\) of order s and degree d can be uniquely written in the form (we recall that if \(P(x)=\sum _{j=s}^d a_jx^j\), where \(a_s\ne 0\), then we define the order of polynomial P as the number \(ord P=s\))

$$\begin{aligned} P(x)=\sum _{j=0}^{\left\lfloor \frac{d-s}{2}\right\rfloor } a_{s+j}x^{s+j}(1+x)^{d-s-2j}, \end{aligned}$$

where \(a_{s+j}\in {\mathbb {Z}}\). Then \(a_s=c_s\). Moreover, if polynomials \(P_1, P_2, \dots , P_r\) are palindromic and there exists \(c\in {\mathbb {N}}\) such that \(ord P_i+\deg P_i=c\) for every \(i\in \{1,2,\dots ,r\}\) then the polynomial \(\sum _{i=1}^r P_i\) is palindromic.

Lemma 4.17

We have

$$\begin{aligned} h_{1,k+1,2}(x)&=\sum _{j=0}^k a_{j,k}x^j(1+x)^{2k-2j},\quad k\in {\mathbb {N}},\\ h_{2,k+1,4}(x)&=\sum _{j=0}^k b_{j,k}x^j(1+x)^{2k-2j},\quad k\in {\mathbb {N}}_+, \end{aligned}$$

where \(a_{0,k}=2\), \(b_{0,k}=14\), \(8\mid a_{j,k}\) and \(8\mid b_{j,k}\) for \(j>0\).

Proof

We proceed by induction on k. If \(k=0\) then \(h_{1,0+1,2}(x)=2\). Assume now that \(h_{1,k+1,2}(x)=\sum _{j=0}^k a_{j,k}x^j(1+x)^{2k-2j}\) for some \(k\in {\mathbb {N}}\), where \(a_{0,k}=2\) and \(8\mid a_{j,k}\) for \(j>0\). Then

$$\begin{aligned} \begin{aligned} h_{1,k+2,2}(x)&=\frac{1}{2}\left( (1+\sqrt{x})^{2k+4}h_{1,k+1,2}(\sqrt{x})+(1-\sqrt{x})^{2k+4}h_{1,k+1,2}(-\sqrt{x})\right) \\&=\sum _{j=0}^k \frac{1}{2}a_{j,k}\left( \sqrt{x}^j(1+\sqrt{x})^{4k-2j+4}+(-\sqrt{x})^j(1-\sqrt{x})^{4k-2j+4}\right) . \end{aligned} \end{aligned}$$
(19)

For each \(j\in \{0,1,\dots ,k\}\) the expression

\(\frac{1}{2}a_{j,k}\left( \sqrt{x}^j(1+\sqrt{x})^{4k-2j+4}+(-\sqrt{x})^j(1-\sqrt{x})^{4k-2j+4}\right) \) is a palindromic polynomial in \({\mathbb {Z}}[x]\) of degree \(2k-j+\left\lfloor \frac{j}{2}\right\rfloor +2\) and order \(\left\lceil \frac{j}{2}\right\rceil \). Hence the sum of degree and the order of the jth summand is equal to \(2k+2\) and by Lemma 4.16 the polynomial \(h_{1,k+2,2}(x)\) is palindromic. The degree of \(h_{1,k+2,2}\) is \(2k+2\) and its leading coefficient is equal to \(a_{0,k}=2\), thus by Lemma 4.16 this polynomial can be uniquely written in the form \(h_{1,k+2,2}(x)=\sum _{j=0}^{k+1} a_{j,k+1}x^j(1+x)^{2k+2-2j}\), where \(a_{0,k+1}=2\). It suffices to show that \(8\mid a_{j,k+1}\) for \(j>0\). Since \(8\mid a_{j,k}\) for \(j>0\), the jth summand in (19), \(j>0\), has no influence on the values \(a_{j,k+1}\pmod {8}\), so we can skip them. Let us consider the 0th summand in (19).

$$\begin{aligned}&\left( (1+\sqrt{x})^{4k+4}+(1-\sqrt{x})^{4k+4}\right) =2\sum _{j=0}^{2k+2} {4k+4\atopwithdelims ()2j}x^j\\&\quad =2(1+x)^{2k+2}+2\sum _{j=1}^{2k+1} \left( {4k+4\atopwithdelims ()2j}-{2k+2\atopwithdelims ()j}\right) x^j\\&=2(1+x)^{2k+2}+8x\sum _{j=0}^{2k} \alpha _jx^j\\&\quad = 2(1+x)^{2k+2}+8x\sum _{j=0}^{k} a'_jx^j(1+x)^{2k-j}, \end{aligned}$$

where we use Lemma 4.15 to write \({4k+4\atopwithdelims ()2j}-{2k+2\atopwithdelims ()j}=4\alpha _j\) and clearly \(\alpha _{2k-j}=\alpha _j\). Finally, \(a_{j,k+1}\equiv 8a'_{j-1,k+1}\equiv 0\pmod {8}\).

The proof for polynomials \(h_{2,k+1,4}\) is analogous, so we leave its details for the reader.\(\square \)

Now we are ready to prove Theorem 4.14.

Proof of Theorem 4.14

Since the proof for polynomials \(h_{2^k+2,k+1,4}\) is completely analogous, we will only present the proof for polynomials \(h_{2^k+1,k+1,2}\).

We compute \(h_{2^k+1,k+1,2}\) using Lemma 4.17.

$$\begin{aligned} \begin{aligned} h_{2^k+1,k+1,2}&=\frac{1}{2\sqrt{x}}\left( (1+\sqrt{x})^{2k+2}h_{1,k,2}(\sqrt{x})- (1-\sqrt{x})^{2k+2}h_{1,k,2}(-\sqrt{x})\right) \\&=\sum _{j=0}^{k-1} \frac{1}{2\sqrt{x}}a_{j,k-1}\left( \sqrt{x}^j(1+\sqrt{x})^{4k-2j}-(-\sqrt{x})^j (1+\sqrt{x})^{4k-2j}\right) . \end{aligned} \end{aligned}$$

It remains to show that \(4(x+1)\mid \frac{1}{2\sqrt{x}}\left( \sqrt{x}^j(1+\sqrt{x})^{4k-2j}-(-\sqrt{x})^j (1+\sqrt{x})^{4k-2j}\right) \) for even j and \(x+1\mid \frac{1}{2\sqrt{x}}\left( \sqrt{x}^j(1+\sqrt{x})^{4k-2j}-(-\sqrt{x})^j (1+\sqrt{x})^{4k-2j}\right) \) for odd j, since \(2\mid a_{0,k-1}\) and \(8\mid a_{j,k-1}\) for \(j>0\). If j is even then

$$\begin{aligned}&\frac{1}{2\sqrt{x}}\left( \sqrt{x}^j(1+\sqrt{x})^{4k-2j}-(-\sqrt{x})^j (1+\sqrt{x})^{4k-2j}\right) \\&\quad =\frac{1}{2\sqrt{x}}x^{\frac{j}{2}}\left( (1+\sqrt{x})^{4k-2j}-(1+\sqrt{x})^{4k-2j} \right) \end{aligned}$$

is divisible by \(\frac{1}{2\sqrt{x}}\left( (1+\sqrt{x})^4-(1-\sqrt{x})^4\right) =4(1+x)\). If j is odd then

$$\begin{aligned}&\frac{1}{2\sqrt{x}}\left( \sqrt{x}^j(1+\sqrt{x})^{4k-2j}-(-\sqrt{x})^j (1+\sqrt{x})^{4k-2j}\right) \\&\quad =\frac{1}{2}x^{\frac{j-1}{2}}\left( (1+\sqrt{x})^{4k-2j} +(1+\sqrt{x})^{4k-2j}\right) \end{aligned}$$

is divisible by \(\frac{1}{2}\left( (1+\sqrt{x})^2+(1-\sqrt{x})^2\right) =1+x\). \(\square \)

Let \(i\in \{0,1\}\) and observe that the generating function for the sequence \((h_{i,1,m}(x))_{m\in {\mathbb {N}}}\) is rational. More precisely, we have

$$\begin{aligned} G_{0,1}(x,T)&=\sum _{m=0}^{\infty }h_{0,1,m}(x)T^{m}=\sum _{m=0}^{\infty } \frac{1}{2}((1+\sqrt{x})^{m}+(1-\sqrt{x})^{m})T^{m}\\&=\frac{T-1}{(x-1)T^2+2T-1},\\ G_{1,1}(x,T)&=\sum _{m=0}^{\infty }h_{1,1,m}(x)T^{m}=\sum _{m=0}^{\infty } \frac{1}{2\sqrt{x}}((1+\sqrt{x})^{m}-(1-\sqrt{x})^{m})T^{m}\\&=-\frac{T}{(x-1)T^2+2T-1}. \end{aligned}$$

This suggests that for any given \(k\in {\mathbb {N}}_{+}\) and \(i\in \{0,\ldots , 2^{k}-1\}\) the sequence \((h_{i,k,m}(x))_{m\in {\mathbb {N}}}\) should satisfy a linear recurrence. We confirm this in the following result.

Theorem 4.18

Let \(k\in {\mathbb {N}}_{+}\) and \(i\in \{0,\ldots ,2^{k}-1\}\) and define

$$\begin{aligned} G_{i,k}(x,T)=\sum _{m=0}^{\infty }h_{i,k,m}(x)T^{m}. \end{aligned}$$

Then the function \(G_{i,k}\) is rational (as a function in two variables xT). In particular the sequence \((h_{i,k,m}(x))_{m\in {\mathbb {N}}}\) is annihilated by the difference operator \(V_{k}\) defined recursively in the following way:

$$\begin{aligned} V_{1}(x,\theta )= & {} (x-1)\theta ^2+2\theta -1,\quad V_{k+1}(x,\theta )=V_{k}(\sqrt{x},(1+\sqrt{x})^{k+1}\theta )\\&V_{k}(-\sqrt{x},(1-\sqrt{x})^{k+1}\theta ), \end{aligned}$$

where \(\theta ((a_{n})_{n\in {\mathbb {N}}_{\ge r}})=(a_{n-1})_{n\in {\mathbb {N}}_{\ge r+1}}\).

Proof

If \(k=1\) then the function \(G_{i,1}(x,T)\) is rational with respect to variables x and T for \(i\in \{0,1\}\). Assume now that \(G_{i,k}(x,T)=\frac{P_{i,k}(x,T)}{Q_{i,k}(x,T)}\) for some \(k\in {\mathbb {N}}_+\) and every \(i\in \{0,1,\dots ,2^k-1\}\), where \(P_{i,k},Q_{i,k}\in {\mathbb {Z}}[x,T]\), \(Q_{i,k}\ne 0\). Then we use the recurrence from Lemma 4.7. We thus have for \(i\in \{0,1,\dots ,2^k-1\}\):

$$\begin{aligned} G_{i,k+1}(x,T)&=\sum _{m=0}^{\infty }h_{i,k+1,m}(x)T^{m}\\&=\sum _{m=0}^{\infty }\frac{1}{2}\left( h_{i,k,m}(\sqrt{x})(1+\sqrt{x})^{m(k+1)}+h_{i,k,m}(-\sqrt{x})(1-\sqrt{x})^{m(k+1)}\right) T^{m}\\&=\frac{1}{2}\left( G_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)+G_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)\right) \\&=\frac{1}{2}\left( \frac{P_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)}{Q_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)}+\frac{P_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)}{Q_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)}\right) \\&=\frac{\hat{P}_{i,k+1}(\sqrt{x},T)}{\hat{Q}_{i,k+1}(\sqrt{x},T)},\\ G_{i+2^k,k+1}(x,T)&=\sum _{m=0}^{\infty }h_{i+2^k,k+1,m}(x)T^{m}\\&=\sum _{m=0}^{\infty }\frac{1}{2\sqrt{x}}\left( h_{i,k,m}(\sqrt{x})(1+\sqrt{x})^{m(k+1)}-h_{i,k,m}(-\sqrt{x})(1-\sqrt{x})^{m(k+1)}\right) T^{m}\\&=\frac{1}{2\sqrt{x}}\left( G_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)-G_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)\right) \\&=\frac{1}{2\sqrt{x}}\left( \frac{P_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)}{Q_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)}-\frac{P_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)}{Q_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)}\right) \\&=\frac{\hat{P}_{i+2^k,k+1}(\sqrt{x},T)}{\hat{Q}_{i+2^k,k+1}(\sqrt{x},T)}, \end{aligned}$$

where

$$\begin{aligned} \begin{aligned} \hat{P}_{i,k+1}(\sqrt{x},T) =&\frac{1}{2}\left( P_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)Q_{i,k}(-\sqrt{x}, (1-\sqrt{x})^{k+1}T)\right. \\&\left. +P_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)Q_{i,k}(\sqrt{x}, (1+\sqrt{x})^{k+1}T)\right) ,\\ \hat{P}_{i+2^k,k+1}(\sqrt{x},T) =&\frac{1}{2\sqrt{x}}\left( P_{i,k}(\sqrt{x}, (1+\sqrt{x})^{k+1}T)Q_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T)\right. \\&\left. -P_{i,k}(-\sqrt{x}, (1-\sqrt{x})^{k+1}T)Q_{i,k}(\sqrt{x},(1+\sqrt{x})^{k+1}T)\right) ,\\ \hat{Q}_{i,k+1}(\sqrt{x},T) =&\hat{Q}_{i+2^k,k+1}(\sqrt{x},T)=Q_{i,k} (\sqrt{x},(1+\sqrt{x})^{k+1}T)\\&\quad \times Q_{i,k}(-\sqrt{x},(1-\sqrt{x})^{k+1}T). \end{aligned} \end{aligned}$$
(20)

One can easily check that the polynomials \(\hat{P}_{i,k+1}\), \(\hat{Q}_{i,k+1}\), \(\hat{P}_{i+2^k,k+1}\), \(\hat{Q}_{i+2^k,k+1}\in {\mathbb {Z}}[\sqrt{x},T]\), treated as functions, are even with respect to the first variable. Hence

$$\begin{aligned} \begin{aligned} \hat{P}_{i,k+1}(\sqrt{x},T)&=P_{i,k+1}(x,T),\\ \hat{P}_{i+2^k,k+1}(\sqrt{x},T)&=P_{i+2^k,k+1}(x,T),\\ \hat{Q}_{i,k+1}(\sqrt{x},T)&=Q_{i,k+1}(x,T),\\ \hat{Q}_{i+2^k,k+1}(\sqrt{x},T)&=Q_{i+2^k,k+1}(x,T) \end{aligned} \end{aligned}$$
(21)

and as a result \(G_{i,k+1}(x,T)=\frac{P_{i,k+1}(x,T)}{Q_{i,k+1}(x,T)}\) and \(G_{i+2^k,k+1}(x,T)=\frac{P_{i+2^k,k+1}(x,T)}{Q_{i,k+1}(x,T)}\). Since \(\deg P_{i,0}<\deg Q_{i,0}\) for \(i\in \{0,1\}\), by formulae (20) and (21) we conclude that \(\deg P_{i,k}<\deg Q_{i,k}\) for any \(k\in {\mathbb {N}}\) and \(i\in \{0,1,\dots ,2^k-1\}\). Hence the equality \(Q_{i,k}(x,T)G_{i,k}(x,T)=P_{i,k}(x,T)\) implies annihilation of the sequence \((h_{i,k,m}(x))_{m\in {\mathbb {N}}}\) by the operator \(V_k(x,\theta )=Q_{i,k}(x,\theta )\). \(\square \)

5 Questions, remarks and conjectures

In this section we present several questions and conjectures which appeared during our work on this paper. We also present some related results.

We proved that the sequence \(\nu _{2}(t_{2^{k}}(n))\) is 2-regular. This result motivates the following

Question 5.1

Let \(m\in {\mathbb {N}}_{\ge 2}\) be given. Is the sequence \((\nu _{2}(t_{m}(n))_{n\in {\mathbb {N}}}\,2\)-regular?

Numerical computations in Wolfram Mathematica [20] make us state the following conjecture on the 2-adic valuation of numbers \(t_{2^k+1}(n)\), \(n\in {\mathbb {N}}\), where \(k\in {\mathbb {N}}_2\) is fixed.

Conjecture 5.2

For each \(n\in {\mathbb {N}}\) we have the following equalities:

$$\begin{aligned} \nu _2(t_5(4n+j))&=4\left\lceil \frac{\nu _2(n+1)}{2}\right\rceil -(\nu _2(n+1)\pmod {2}), \quad j\in \{0,1,2,3\},\\ \nu _2(t_9(8n+j))&=5\left\lceil \frac{\nu _2(n+1)}{2}\right\rceil -2(\nu _2(n+1)\pmod {2}), \quad j\in \{0,1,\dots ,7\}. \end{aligned}$$

In general, for each \(k\in {\mathbb {N}}_2\) there exists a strictly increasing sequence \((A_{k,n})_{n\in {\mathbb {N}}}\) of nonnegative integers such that \(A_{k,0}=0\) and

$$\begin{aligned} \nu _2(t_{2^k+1}(2^kn+j))=A_{k,\nu _2(n+1)} \end{aligned}$$

for each \(n\in {\mathbb {N}}\) and \(j\in \{0,1,\dots ,2^k-1\}\).

Using Lemma 3.2 we can verify that \(\nu _2(t_{2^k+1}(2^kn+j))=0\) if and only if n is even.

We believe that the following more general statement is true.

Conjecture 5.3

Let \(m\in {\mathbb {N}}_{\ge 2}\) be given and suppose that m is not of the form \(2^{k}-1\) for \(k\in {\mathbb {N}}_{+}\). Then the sequence \((\nu _{2}(b_{m}(n)))_{n\in {\mathbb {N}}}\) is unbounded.

We performed extensive calculations in the case of \(m=2\) and observed some interesting phenomena concerning the solutions of the equation \(\nu _{2}(b_{2}(n))=a\), where a is fixed positive integer. In order to investigate this equation we computed all polynomials \(h_{i,k,2}(x)\) for \(k\le 8\) and \(i\le 2^{k}-1\) and looked for these satisfying the congruence \(h_{i,k,2}(x)\equiv 0\pmod {2^{a}}\) in \({\mathbb {Z}}[x]\). For any given polynomial of this type we immediately got the inequality \(\nu _{2}(b_{2}(2^{k}n+i))\ge a\) for each \(n\in {\mathbb {N}}\). Then we checked whether the inequality is in essence an equality. In order to verify this it is enough to check whether the following congruence holds

$$\begin{aligned} \frac{H_{i,k,2}(x)}{2^{a}}=\frac{h_{i,k,2}(x)}{2^{a}(1-x)^{2k}}H_{2}(x)\equiv \frac{1}{1-x}\pmod {2}. \end{aligned}$$

However, \(H_{2}(x)\equiv (1-x)^{2}\pmod {2}\) and thus it is enough to check whether

$$\begin{aligned} \frac{h_{i,k,2}(x)}{2^{a}(1-x)^{2(k-1)}}\equiv \frac{1}{1-x}\pmod {2}\Longleftrightarrow \frac{h_{i,k,2}(x)}{2^{a}}\equiv (1-x)^{2k-3}\pmod {2}. \end{aligned}$$

This is easy (at least in the range we considered) and we were able to prove the following

Theorem 5.4

The following equalities are true:

$$\begin{aligned}&\nu _{2}(b_{2}(4n+3))=3,\\&\nu _{2}(b_{2}(8n+5))=3,\\&\nu _{2}(b_{2}(16n+i))=3 \quad for\; i\in \{6,9,12\},\\&\nu _{2}(b_{2}(32n+i))=3 \quad for\; i\in \{8,17,26\},\\&\nu _{2}(b_{2}(64n+i))=3 \quad for\; i\in \{16,33,50\},\\&\nu _{2}(b_{2}(128n+i))=3 \quad for\; i\in \{32,65,98\},\\&\nu _{2}(b_{2}(256n+i))=3 \quad for\; i\in \{64,129,194\},\\&\nu _{2}(b_{2}(32n+i))=4 \quad for\;i\in \{4,30\},\\&\nu _{2}(b_{2}(64n+i))=4 \quad for\; i\in \{10,56\},\\&\nu _{2}(b_{2}(128n+i))=4 \quad for\; i\in \{48,82\},\\&\nu _{2}(b_{2}(256n+i))=4 \quad for\; i\in \{96,162\},\\&\nu _{2}(b_{2}(64n+i))=5 \quad for\; i\in \{20,46\},\\&\nu _{2}(b_{2}(128n+i))=5\quad for\; i\in \{42,88\},\\&\nu _{2}(b_{2}(256n+i))=5 \quad for\; i\in \{18,240\},\\&\nu _{2}(b_{2}(128n+i))=6 \quad for\; i\in \{14,116\},\\&\nu _{2}(b_{2}(256n+i))=6 \quad for\; i\in \{106,152\},\\&\nu _{2}(b_{2}(256n+i))=7 \quad for\; i\in \{78,180\}.\\ \end{aligned}$$

We also expect that the following congruences are true.

Conjecture 5.5

Let m be a fixed positive integer. Then for each \(n\in {\mathbb {N}}\) and \(k\ge m+2\) the following congruence holds:

$$\begin{aligned} b_{2^{m}}\left( 2^{k+1}n\right) \equiv b_{2^{m}}\left( 2^{k-1}n\right) \pmod {2^{k}}. \end{aligned}$$

Conjecture 5.6

Let m be a fixed positive integer. Then for each \(n\in {\mathbb {N}}\) and \(k\ge m+2\) the following congruence holds:

$$\begin{aligned} b_{2^{m}-1}\left( 2^{k+1}n\right) \equiv b_{2^{m}-1}\left( 2^{k-1}n\right) \pmod {2^{4\lfloor \frac{k+1}{2}\rfloor -2}}. \end{aligned}$$

In fact we expect the following.

Conjecture 5.7

Let m be a fixed positive integer. Then for each \(n\in {\mathbb {N}}\) and given \(k\gg 1\) there is a non-decreasing function \(f:{\mathbb {N}}\rightarrow {\mathbb {N}}\) such that \(f(k)=O(k)\) and the following congruence holds

$$\begin{aligned} b_{m}\left( 2^{k+1}n\right) \equiv b_{m}\left( 2^{k-1}n\right) \pmod {2^{f(k)}}. \end{aligned}$$

According to numerical computations we noticed that for \(m\ge 2\) we have

$$\begin{aligned} t_m(3n)>0,\quad t_m(3n+1)<0 \end{aligned}$$

for most values \(n\in {\mathbb {N}}\). However, \(t_m(3n)<0\) for some n and similarly \(t_m(3n+1)>0\) for some n. Hence we have the following supposition.

Conjecture 5.8

Let m be a positive integer \(\ge 2\). Let us define

$$\begin{aligned} \mathcal {A}_{m,j}=\left\{ n\in {\mathbb {N}}: \mathrm{sgn}\; t_m(3n+j)\ne (-1)^j\right\} ,\quad j\in \{0,1\}. \end{aligned}$$

Then the sets \(\mathcal {A}_{m,j}\) are infinite and they have asymptotic density equal to 0, i.e.,

$$\begin{aligned} \lim _{n\rightarrow +\infty } \frac{\sharp \mathcal {A}_{m,j}\cap \{0,1,\dots ,n-1\}}{n}=0. \end{aligned}$$

We also have seen that for initial values \(m,n\in {\mathbb {N}}_+\), \(m\ge 2\), the numbers \(t_m(n-1)\), \(t_m(n)\), \(t_m(n+1)\) do not have the same sign, as well. Moreover we noted that \(t_m(n)^2>t_m(n-1)t_m(n+1)\).

Conjecture 5.9

For any \(m,n\in {\mathbb {N}}_+\), \(m\ge 2\), the numbers \(t_m(n-1)\), \(t_m(n)\), \(t_m(n+1)\) do not have the same sign and \(t_m(n)^2>t_m(n-1)t_m(n+1)\).

The above conjecture was proved in Sect. 3 for \(m=2\).

We stated that \((-1)^n\left( b_m(n)^2-b_m(n-1)b_m(n+1)\right) >0\) for \(m\in \{1,2\}\) and \(n\in {\mathbb {N}}_+\). We noticed that the behaviour of the expressions \(b_m(n)^2-b_m(n-1)b_m(n+1)\) for \(m>2\) is different. Namely, we expect that following is true.

Conjecture 5.10

If \(m\ge 4\) then \(b_m(n)^2-b_m(n-1)b_m(n+1)>0\) for any \(n\in {\mathbb {N}}_+\).

For \(m=3\) there exists \(n_0\in {\mathbb {N}}_+\) such that \((-1)^n\left( b_3(n)^2-b_3(n-1)b_3(n+1)\right) >0\) for \(n\le n_0\) and \(b_3(n)^2-b_3(n-1)b_3(n+1)>0\) for \(n>n_0\).