Finite arithmetic progressions in cyclic groups

Jeffery MensahJuly 8, 2024∼750 words

Here are two puzzles of my own invention concerning finite arithmetic progressions in cyclic (or monothetic) groups. An example this is a sequence of regularly scheduled meetings spread throughout multiple years (e.g. 10 meetings occuring once every 60 days). Both questions involve determining when it is possible to find a progression disjoint from a given set of points (e.g. holidays). One of these problems is in a "discrete" setting while the other one is in a "continuous" setting.

Problem 1

Let qq be a prime number and SZ/qZS \subseteq \mathbb Z / q \mathbb Z be a subset of size nn. Devise an algorithm to determine the number of arithmetic progressions of length kk in Z/qZ\mathbb Z / q \mathbb Z disjoint from SS, with time complexity O(qnlogn)\mathscr O (qn \log n).

Solution to Problem 1

For each ΔZq/Z×\Delta \in \mathbb{Z} q / \mathbb{Z}^\times, we find the number of arithmetic progressions disjoint from SS of length kk, with common difference Δ\Delta, which we denote by νk,Δ(S)\nu_{k, \Delta}(S). When Δ=0\Delta = 0, the number of constant arithmetic progressions disjoint from SS is simply qSq - \abs{S}.

Otherwise, note that multiplication by Δ1\Delta^{-1} is an isomorphism of Z/qZ\mathbb{Z}/q\mathbb{Z} taking an arithmetic progression with common difference Δ\Delta to a progression with common difference 11. It follows that νk,Δ(S)=νk,1(Δ1S)\nu_{k, \Delta}(S) = \nu_{k,1}(\Delta^{-1} S), which is the number of contiguous subsets of length kk disjoint from Δ1S\Delta^{-1} S. To calculate this, we write Δ1S={s1,,sn}\Delta^{-1} S = \{s_1, \ldots, s_n\}, where each sis_i is a representative in {0,,q1}\{0, \ldots , q-1\} such that s1<<sns_1 < \cdots < s_n, and let δi\delta_i be the smallest positive integer such that si+1=δi+sis_{i+1} = \delta_{i} + s_i, taking indices modulo nn. Then

νk,Δ(S)=νk,1({s1,,sn})=i=1nmax(δik,0).\nu_{k,\Delta}(S) = \nu_{k,1}(\{s_1, \ldots, s_{n}\}) = \sum_{i=1}^{n} \max(\delta_{i} - k, 0).

The time complexity of an algorithm following this procedure is O(qnlogn)\mathscr{O}(q \cdot n \log n), since there are q1q-1 remaining values of Δ\Delta to iterate over, and for each value of Δ\Delta, one must

  1. sort Δ1S\Delta^{-1} S, requiring at most O(nlogn)\mathscr{O}(n \log n) operations, and
  2. compute νk,1(Δ1S)\nu_{k,1}(\Delta^{-1} S) using the given sum, requiring O(n)\mathscr{O}(n) operations.

A potential implementation of this algorithm in Python is the following:

def delta(a, b, q):
    return q if a == b else (a - b + q) % q

def nu(k, q, S):
    total = q - len(S)
    if k > 1:
        for d in range(1, q):
            dS = sorted([d * s for s in S])
            total += sum([max((delta(dS[(i + 1) % len(S)], dS[i], q) - k, 0)) for i in range(len(S))])
    return total

Problem 2

For each Fibonacci number kk, determine whether or not there exists an arithmetic progression in R/Z\mathbb{R}/\mathbb{Z} of length kk and common difference ϕ\phi (the golden ratio) disjoint from some open ball of radius 1/k1/k.

Solution to Problem 2

The answer is no.

Let FnF_n denote the nnth Fibonacci number, and I=B1/Fn(x)I = B_{1/F_n}(x) be an arbitrary open ball of radius 1Fn\frac{1}{F_n}. We show that any arithmetic progression with length FnF_n and common difference ϕ\phi must intersect II at some point.

Given such a progression (aj)j=0Fn1(a_j)_{j=0}^{F_n-1}, consider the progression (bj)j=0Fn1(b_j)_{j=0}^{F_n-1} given by bj=a0+jFn+1Fnb_j = a_0 + j \cdot \frac{F_{n+1}}{F_n}. Since FnF_{n} and Fn+1F_{n+1} are relatively prime, we have

{b0,,bFn1}=b0+Fn+1Fn=b0+1Fn. \{b_0, \ldots, b_{F_n - 1}\} = b_{\hspace{0.3pt}0} + \big\langle \tfrac{F_{n+1}}{F_n} \big\rangle = b_{\hspace{0.3pt}0} + \big\langle \tfrac{1}{F_n} \big\rangle.

It follows that we can cover the circle with intervals of length 1/Fn1/F_n centered at each element, that is,

R/Z=k=1FnB1/Fn(kFn)=k=1FnB1/Fn(b0+kFn)=j=1FnB1/Fn(bj) \mathbb{R}/\mathbb{Z} = \bigcup_{k = 1}^{F_n} \overline{B_{1/F_n}}\big(\tfrac{k}{F_n}\big) = \bigcup_{k = 1}^{F_n} \overline{B_{1/F_n}}\big(b_{\hspace{0.3pt}0} + \tfrac{k}{F_n}\big) = \bigcup_{j = 1}^{F_n} \overline{B_{1/F_n}}\left(b_j\right)

Hence, the center xx must lie in an interval B1/Fn(bj)\overline{B_{1/F_n}}\left(b_j\right). Note that the successive ratio ϕn=Fn+1/Fn\phi_n = F_{n+1}/F_n of Fibonacci numbers approximates ϕ\phi very well, in the sense that

ϕϕn=limmFm+1FmFn+1Fn=limmFm+1FnFn+1FmFmFn=limmFmnFmFn=1ϕnFn<1Fn25. \left|\phi - \phi_n\right| = \lim_{m \to \infty} \left|\frac{F_{m+1}}{F_m} - \frac{F_{n+1}}{F_n}\right| = \lim_{m \to \infty} \left|\frac{F_{m+1}F_{n} - F_{n+1}F_m}{F_mF_n} \right| = \lim_{m \to \infty} \left| \frac{F_{m-n}}{F_m F_n} \right| = \frac{1}{\phi^{n}F_n} < \frac{1}{F_n^2\sqrt{5}}.

Thus d(aj,bj)ajbjjϕϕn1Fn5d(a_j, b_j) \leq |a_j - b_j| \leq j|\phi - \phi_n| \leq \frac{1}{F_n\sqrt{5}}. Finally, by the triangle inequality, we must have

d(aj,x)d(aj,bj)+d(x,bj)1Fn5+12Fn<2. d(a_j, x) \leq d(a_j, b_j) + d(x, b_j) \leq \frac{1}{F_n\sqrt{5}} + \frac{1}{2F_n} < 2.

Hence ajIa_j \in I. Therefore, any arithmetic progression of length FnF_n with common difference ϕ\phi must intersect II at some point.