# Bounding the discrepancy in terms of the common difference

Many approaches to EDP proceed by considering $\mathcal{A}_n$, the set of HAPs contained in $\{1, 2, \ldots, n\}$, and trying to proving a lower bound $\omega_n$ for the $\mathcal{A}_n$-discrepancy problem, where $\omega_n \to \infty$.

This page is about an alternative approach: instead of building up the set of HAPs by restricting the maximum and letting it tend to infinity, we build it up by restricting the difference and letting that tend to infinity.

That is, we consider $\mathcal{D}_n$, the set of HAPs with common difference in some set $D_n \subseteq \mathbb{N}^+$, where $D_1 \subseteq D_2 \subseteq \ldots$ and $\bigcup_n D_n = \mathbb{N}^+$, and try to prove a lower bound $\omega_n$ for the $\mathcal{D}_n$-discrepancy problem, where $\omega_n \to \infty$.

The hope is that some of the calculations will be easier in this perspective because we don't have so many 'cut-offs' to worry about. Furthermore, we are forced to work in a more infinitary way from the start. This may be a help or a hindrance.

Many of the natural examples turn out to be a bit nicer if our sequences (and our HAPs) start at zero. So we'll consider infinite sequences $x : \mathbb{N} \to \{\pm 1\}$.

Let $\sigma (x) = \sup_n | \sum_{r\ltn} x_r |$ (which may be finite or infinite), and $\sigma_d (x) = \sigma (T_d(x))$ (where $T_d(x)$ is the sequence defined by $T_d(x)_n = x_{dn}$). Let's also write $\sigma_D (x) = \sup_{d \in D} \sigma_d(x)$, for $D \subseteq \mathbb{N}^+$. Finally, let $\sigma_D = \inf_x \sigma_D(x)$. Ultimately we want to prove that $\sigma_{\mathbb{N}^+} = \infty$.

An obvious question is whether there is a sequence $x$ such that $\sigma_d(x)$ is finite for all $d$. There is: we can take $x_n = (-1)^{\nu(n)}$ where $\nu(n) = \sum_{k=0}^\infty \lfloor \frac{n}{2^k k!} \rfloor$. It is easy to check by induction that $\sigma_d(x) \lt \infty$: $x$ is the pointwise limit of periodic sequences $x_k = \xi_k \xi_k \ldots$ (concatenation of finite blocks) where the length of $\xi_k$ is $2^k k!$ and $\sum_{\{n : d \mid n\}} (\xi_k)_n = 0$ for all $d \leq k$. The block $\xi_k$ is formed by concatenating $2k$ copies of $\xi_{k-1}$ with alternating signs. The sequence starts:

n    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
x_n  +  -  -  +  +  -  -  +  -  +  +  -  -  +  +  -  +  -  -  +  +  -  -  +  -  +


For this sequence we have $\sigma_d \leq 2^d d!$. In fact, $\sigma_1 = 1$, $\sigma_2 = 1$, $\sigma_3 = 4$, $\sigma_4 = 2$, $\sigma_5 = 22$, $\sigma_6 = 3$, $\sigma_7 = 251$, $\sigma_8 = 1$, $\sigma_9 = 28$, $\sigma_{10} = 20$.

The construction of the above sequence is similar in spirit to that of the Thue-Morse sequence, which is given by the similar-looking formula $x_n = (-1)^{\nu(n)}$ where $\nu(n) = \sum_{k=0}^\infty \lfloor \frac{n}{2^k} \rfloor$, and which satisfies $\sigma_{2^k} = 1$ for all $k$, but $\sigma_3 = \infty$.

Sune asked here whether $\sigma_{D} \lt \infty$ for $D = \{ 2^k : k \in \mathbb{N}\} \cup \{3\}$. He and Tim then both gave examples showing this, based on the Thue-Morse sequence, which look as if they should generalize to $D = \{ 2^k : k \in \mathbb{N}\} \cup D_1$ for any finite set $D_1$.

That question was asked in the context of a harder question: whether $\sigma_d$ could be uniformly bounded for $d$ a power of 2 or a prime. This remains unanswered.

It seems quite easy to show that $\sigma_D \lt \infty$ where $D$ is the set of $M$-smooth numbers (for example, $\{2^a 3^b 5^c : a, b, c \in \mathbb{N}\}$). This has been briefly discussed on the EDP blog [link?].

Can we find a good lower bound for $\sigma_{\{1, 2, \ldots, n\}}$? We can probably do much better than $2^n n!$. Can we achieve sub-exponential growth? It certainly looks that way from the numerical evidence: at any rate, one can (with a simple computer program) find a sequence $x$ such that $\sigma_{\{1,2, \ldots, 16\}}(x) = 2$. (The sequence found has period 720720, though there are almost certainly examples with smaller periods.) The gap between this and $2^{16} 16!$ is so huge that it must surely be possible to prove something here.

It is interesting to look for sequences with small periods and small $\sigma_D$. The period-8 sequence

++---++-


repeated indefinitely, has $\sigma_{\{1,2,3,4,5,6,7\}}(x) = 2$. What is the sequence of shortest period with $\sigma_{\{1,2,3,4,5,6,7,8\}} = 2$? Number-crunching shows that the minimal period must be at least 160, and at most 1680.

Define the function $f : \mathbb{N} \to \{\pm 1\}$ by:

• $f(0) = 1$
• $f(4n+1) = 1$
• $f(4n-1) = -1$
• $f(2n) = -f(n) (n \geq 1)$

This is somewhat similar to the definition of the Walters sequence. To find $f(n)$, we write $n$ in base 4 and look at its last nonzero digit. If it is a 1 then $f(n) = 1$; if it is a 3 then $f(n) = -1$. If it is a 2, look at the preceding digit. If that digit is even then $f(n) = -1$; if it is odd then $f(n) = 1$.

The sequence $f(n)$ has slow-growing discrepancy (around $\log_4 n$). It is completely multiplicative, with $f(2)=-1$, $f(p)=1$ if $p \equiv 1 (\mod 4)$ and $f(p)=-1$ if $p \equiv -1 (\mod 4)$. It seems to allow us to generate sequences with small $\sigma_D$. Let $f_k$ be the sequence defined by repeating the first $4^k$ terms of $f$ indefinitely: that is, $f_k(n) = f(n \mod 4^k)$. Then $\sigma_{\{1, 2, \ldots, 4^k-1\}}(f_k) = k+1$. To be precise, for all $k \geq 0, 1 \leq d \lt 4^k$:

• $(\forall N \geq 0) | \sum_{0 \leq r \lt N} f(dr \mod 4^k) | \leq k+1$
• $\sum_{0 \leq r \lt 4^k} f(dr \mod 4^k) = 0$

This follows from the facts that $f$ is multiplicative, $\sum_{0 \leq r \lt 4^k} f(r) = 0$ (for $k \geq 1$), and for $0 \leq m \lt 4^k$, $f(4^k a + m)$ is equal to $f(a)$ if $m=0$, $(-1)^{a+1}$ if $m = 4^k/2$, and $f(m)$ otherwise.