On modular k-free sets

Let $n$ and $k$ be integers. A set $A\subset\mathbb{Z}/n\mathbb{Z}$ is $k$-free if for all $x$ in $A$, $kx\notin A$. We determine the maximal cardinality of such a set when $k$ and $n$ are coprime. We also study several particular cases and we propose an efficient algorithm for solving the general case. We finally give the asymptotic behaviour of the minimal size of a $k$-free set in $\left[ 1,n\right]$ which is maximal for inclusion.


Introduction
Let k 1 be an integer. A set A ⊂ N is said to be k-free if x = ky for all x, y in A. Wang first investigated in 1989 the problem of 2-free sets in the integers and, using elementary tools, he proved in [8] that the maximal density of a 2-free set in 1, n := {1, . . . , n} is 2/3. More recently, Wakeham and Wood studied in [7] a generalisation of 2-free sets into {a, b}-multiplicative sets (ax = by for all x, y ∈ A). Notice that k-free sets are the particular case of {1, k}-multiplicative sets. They studied this problem through graph theory to get the maximal size of such a set. In particular, they showed that the maximal density of a k-free set in 1, n is k/(k + 1).
Beyond their own interest, k-free sets are useful for the study of k-fold Sidon sets. Those sets were first introduced by Lazebnik and Verstraëte in [3] through a work on the generalize Turán number. A 1-fold Sidon set is a Sidon set in the usual sense (x 1 + x 2 = x 3 + x 4 has only trivial solutions). If we denote by D * (A) = {a 1 − a 2 , a 1 = a 2 ∈ A} the set of differences from A, without 0, a 2-fold Sidon set A is a Sidon set which has also the property that D * (A) is a 2-free set. More generally, for a k-fold Sidon set A, D * (A) is a k ′ -free set, for each k ′ k. Using only this fact, Cilleruelo and Timmons proved in [2] that for any integer k 1, a k-fold Sidon set A ⊂ 0, n has at most (n/k) 1/2 + O((nk) 1/4 ) elements.

Definition 1. A set A ⊂ Z is a k-fold Sidon set if
We only know that the main term (n/k) 1/2 is optimal for k = 1. Indeed, Sidon sets have been widely studied (see [4] for a survey) and there exist three constructions of maximal Sidon sets in Z/nZ for some n. Bose and Chowla proved in [1] the existence of a Sidon set of size q + 1 in Z/ q 2 + q + 1 Z (Singer's sets, see also [6]) and q in Z/ q 2 − 1 Z (Bose's sets) where q is a power of a prime. Rusza also made an optimal construction in [5] for Z/ p 2 − p Z where p is a prime number. For k = 2, if n = 2 2 t +1 + 2 t + 1 with t a positive integer, we can extract (see [3]) from a Singer's set a 2-fold Sidon set in Z/nZ of size For k 3, we do not even know if there exists a constant c k > 0 such that for all integers n 1, there is a k-fold Sidon set A ⊂ 0, n with |A| c k n 1/2 .
In all these problems, we see that it is important and useful to study the case of modular sets. In this paper, we will study k-free sets in Z/nZ. Notice that we cover the case of {a, b}multiplicative set in Z/nZ for some a, b and n. Indeed, if gcd(a, n) = 1, an {a, b}-multiplicative set in Z/nZ is a ba −1 -free set.
We denote R k (n) = max {|A| , A is a k-free set in Z/nZ} and we show in this article how to compute this quantity recursively in n (Theorems 1, 2, 3 and 4). Proofs also give a way to construct a k-free set of maximal size.
The study of this quantity strongly depends on the arithmetical relative properties of n and k, that is why we split the results in four theorems. We first deal with the case where k and n are coprime, which is actually the most important case. Indeed, when we define k-fold Sidon sets in Z/nZ, we must add the condition that n is relatively prime to all integers in 1, k . Otherwise, one could have c i (a 1 − a 2 ) = 0 with a 1 = a 2 for some |c i | k, which leads to a nontrivial solution to For k and d integers, we denote by l k (d) the multiplicative order of k in (Z/dZ) * . We also use the notations I for the indicator function of odd numbers and ϕ for the Euler indicator function. Let see now with the first result below how to compute R k (n) in the case gcd(n, k) = 1.
For the problem of upper bound for the size of a 2-fold Sidon set, we are interested in small R 2 (n). Indeed, if n = 2 m −1 is a Mersenne prime number, which implies m prime, then l 2 (n) = m, hence R 2 (n) = n − 1 2 − n − 1 2 log 2 (n − 1) which leads to an upper bound for the size of a 2-fold Sidon set A : Moreover, we prove in Section 3 that for fixed k the error term is o(n). Thus R k (n) = (n − 1)/2 − o(n).
When k divides n, the problem becomes easier and we have the two following results.

Theorem 2.
If m is not divisible by k, then When k 2 divides n, we get a recursive formula. That is the purpose of Theorem 3.

Theorem 3.
Let k, m, and n be integers. Then, we have : Notice that Theorems 1, 2 and 3 cover all cases when k is prime. Moreover, recall that the maximal density of a k-free set in 1, n is k/(k + 1). In the modular case, applying Theorem 3 we get which lead to the next proposition. We will consider again this example in Section 5.
In the general case, we cannot obtain a closed formula, but in Sections 2 and 4 we propose an efficient algorithm to compute R k (n).

Theorem 4.
There exists an algorithm which provides the maximal size of a k-free set in Z/nZ and a method to construct one in O((log(n)) 2 ) operations.
To get this complexity, we must assume that we know the prime factorization of k and n, which is unfortunately hard to obtain in general. However, we can easily apply the algorithm to compute our function R k for new types of k and n. That is the purpose of the theorem below.
Theorem 5. Let p and q be prime numbers, α, β and u be integers.
(2) If gcd(u, p) = 1, (3) If gcd(u, p) = gcd(u, q) = 1, In the same way, we could obviously go further and study the case k = up 3 or n = p α q β r γ for instance, but that would give very unpleasant formulas.
Next, we study k-free sets in the set of integers, and not in modular sets anymore. We wonder what is the minimal size of a k-free set in 1, n which is maximal for inclusion, and we answer it in the following theorem, where we definẽ R k (n) = min {|A| , A ⊂ 1, n a k-free set which is maximal for inclusion} .
In the next section, we introduce some notations and give three lemmas. Section 3 contains the proof of Theorems 1, 2 and 3. In Section 4, we study and prove the algorithm for the general case, which we use in Section 5. We conclude by the proof of Theorem 6 in the last section.

Preparatory lemmas
Let introduce some useful notations for our study. We define O k (x) := k j x, j ∈ N and we call it the orbit of x (by the multiplication by k). We use it in a different context (in Z/nZ or in N, Section 6) with the same notation. We denote by k · A := {ka, a ∈ A} the dilated set of A and by A m the subset of Z/nZ To study k-free sets, it is important to know more about O k (x) for each x ∈ Z/nZ. That is the purpose of our first two lemmas.
. But for all z in A m ′ , there exists w, gcd(w, n) = 1 and z = wy. Clearly, xw belongs to A m and z = kxw, which concludes the proof.

Lemma 2. Let m be a divisor of n, k be an integer such that gcd(k, n/m)
Proof. Since x ∈ A m , if we denote by < x > the subgroup generated by x, we have Then, since k is invertible in this subgroup and the size of < k > in this subgroup is exactly l k (n/m). Now, we need a result about specific rooted trees. That is the purpose of the next lemma which will be very useful for the proof of Theorem 4.
Let T be a rooted tree where the set of nodes is V = {v i } i∈I with I a finite set and E is the set of edges. We associate a value α i 0 to each v i and we denote by l i its level (recall that the level of a node is defined by 1+ the minimal number of connections between the node and the root). Assume that T has the following property : In other words, α is strictly increasing in each branche. Notice that this condition implies that if v i is not the root of T , α i > 0. We search a subset A of I satisfying : We denote by l the maximal level in T and we construct a set B by the following algorithm : It is clear that B satisfies (2). Actually, B is the required set for our problem. Proof. We proceed by induction on the size of I. If |I| = 1 there is nothing to say.
Let n be an integer and assume that the lemma holds for all k less than n. Let |I| = n + 1, B the set from the algorithm applied to T and C be a subset of I maximizing Λ A among the sets A satisfying (2). We denote by v 0 the root of T , and v i , i ∈ 1, K the childs of v 0 . We also define T i the rooted subtree of T of root v i for all i in 1, Thus, by the definition of C, this is an equality, and finally B = C.
If v 0 / ∈ B and v 0 / ∈ C, we have which ensure that B = C for the same reason.
If v 0 ∈ B and v 0 / ∈ C, since α 0 > 0 (otherwise, v 0 is not in B according to the algorithm), we have which leads to a contradiction.
If v 0 / ∈ B and v 0 ∈ C, α 0 > 0 (since C satisfies (2)) and it means that there exists i 0 in 1, K such that v i0 ∈ B. Then, we consider the branche from v 0 which contains v i0 . If K > 1, its size is strictly less than n + 1 and we can apply the induction hypothesis to get Λ Ci 0 + α 0 < Λ Bi 0 . Thus, and we have a contradiction. If K = 1, we denote by v 1 the only child of v 0 , v 1 ∈ B and v 1 / ∈ C, and considering now the subtrees whose the roots are every nodes of level 2, we get This is a contradiction.
Finally, B = C in every cases and the lemma is proved.

Proof of Theorems 1, 2 and 3
We first deal with the Theorem 1, the case gcd(n, k) = 1.
Proof. As mentioned in the introduction, let l k (d) be the order of k in (Z/dZ) * and I be the indicator function of odd numbers.
By lemma 1, O k (x) ⊂ A m , for all x in A m . Therefore, we consider the suitable partition Notice that this partition is trivial if n is prime. By lemma 2, if x ∈ A m , we have Hence, we can make a partition of A m in ϕ(n/m)/l k (n/m) distinct orbits of length l k (n/m). In each orbit, to get an optimal k-free set, we have to take the most possible elements without taking two consecutive elements. But the orbits are cyclic, that's why if the length l of an orbit is even, we can take l/2 elements, whereas if l is odd, we can take only (l − 1)/2 elements. We finally get the formula Actually, if we fix k, R k (n) is asymptotically (n − 1)/2 − o(n). Indeed, for all ε > 0, there exists d 0 such that log k d 0 1/ε and there exists n such that d 2 0 /6 εn/2. Thus, Now, we consider the case n = k 2 m, for which we have a suitable partition of Z/nZ :

Lemma 4. In this case, we have
Proof. Indeed, if x ≡ 0 (mod k 2 ) and x ≡ 0 (mod k), then x = kh with h ≡ 0 (mod k). Thus, we have all the elements in this union. Moreover, if we have h ≡ 0 (mod k), then kh ≡ 0 (mod k 2 ), which shows that the first union is disjoint.
Let see now why this is a good repartition of elements for our problem, through the proof of Theorem 3 : Proof. We remark two main things : • k 2 Z/nZ is stable for multiplication by k.
• If h ≡ 0 (mod k), we can not write h = ku in k 2 Z/nZ.
We consider now A a k-free set in Z/nZ. First, for each h ≡ 0 (mod k), at most one of {h, kh} lies in A. Furthermore, by the first remark, A ∩ k 2 Z/nZ is also a k-free set, which can be easily seen equivalent to a k-free set in Z/mZ. This leads to Let see now the construction of an optimal k-free set. By the second remark, we can take every h ≡ 0 (mod k) in A, and we now that kh / ∈ k 2 Z/nZ, so we can take R k (m) elements from k 2 Z/nZ in A. Thus, we get and that concludes the proof.
Finally, we consider n = km with m ≡ 0 (mod k). In this case, we have : Proof. If x ≡ 0 (mod k), there exists u such that x = ku. If u ≡ 0 (mod k), x is in the right form. Else, u ≡ 0 (mod k), then there exists v, u = kv and we have But m ≡ 0 (mod k) by hypothesis, then we can write m = lk + a with a ≡ 0 (mod k). We get x + km = k(kv + lk + a).
Since h = kv + lk + a ≡ 0 (mod k), we have written x = x + km = kh with h ≡ 0 (mod k), which concludes the lemma.
We can now easily prove Theorem 2. We first need to well understand this graph, then we will associate suitable values to vertices for our problem. We write n =

Proof. If
Proof. We define We have to study three cases : Through those observations, we get the conclusions of the proposition. Now, we need to see how to give valuations for vertices. The main problem comes from roots, which are the m satisfying k · A m = A m . The next lemma computes the maximal size of a k-free set in A m when m is a root of our graph.

Lemma 7.
If m is a root of our graph (which is tantamount to gcd(k, n/m) = 1), the maximum size of a k-free set included in A m is Proof. We have the isomorphism : But we are in the case gcd(k, n/m) = 1, and if we look through the proof of Theorem 1, we get immediately the result.
Thus, we define the valuation of vertices for all m which divides n : Notice that our graph has the property 1, which we recall here : If v i is the parent of v j , then α i < α j .
When we apply the algorithm of Section 2, we get a set B of vertices. To construct a k-free set, we can join A m for m in B and not a root, and for the roots m in B we can take K m a maximal k-free set in A m . More precisely, we define which is clearly a k-free set since B satisfies 2 and by the definition of K m . Proof. Assume that C is a k-free set in Z/nZ with |C| > B . Let x be an element in C\B of maximal level t, m the integer such that x ∈ A m and T i the rooted tree which contains m.
First case : t = 1 and m / ∈ B. Thus, m is a root but not in B, which means that there is a child m ′ of m in B (otherwise α m = R k (A m ) = 0 and C could not be a k-free set). Then, the set k −1 (x) = {y ∈ A m ′ |y = kx} has no element in C but has size and by substituting {x} by k −1 (x), we get a k-free set (since t is the maximal level of an element of C\B) of size strictly greater than C.
Second case : t > 1. By the construction of B, m does not belong to B and we can do as in the previous case.
The two cases lead to a contradiction, then all elements x in C\B satisfy t = 1 and m belongs to B. Thus, m is a root and we can substitute C ∩A m by K m for each root, and we get |C| B . We finally get the result by counting the size of B.
Thus, to get R k (n), if the prime factorization of k and n is known, we need to construct the graph (O(log(n)) operations), to apply the algorithm (O(log(n))), to compute α m for m in B (O((log(n)) 2 ) operations since we have the prime factorization of m) and finally add those values.

Applications of Theorem 4
Now, to illustrate the method in a particular case, we deal with the example mentioned in introduction, which is n = 3 3 .5 4 .7 2 = 826875 and k = 3.5 = 15. In this case, we get a forest with roots 3 3 .5 4 , 3 3 .5 4 .7 and 3 3 .5 4 .7 2 . We just represent below one of those trees. To get the second, we have to multiply each vertice by 7, and for the third, by 7 2 . Applying the algorithm, we get : To get the maximal size of a 15-free set in Z/826875Z we have to sum all ϕ(n/m) for all m choosen by the algorithm in each tree. And we get R 15 (826875) = 775180 as we deduced from Theorems 2 and 3.
This way to compute R k (n) does not give a general formula, that is why we study in Theorem 5 theorem several cases, which we prove here.

Proof.
(1) The first graph below is the one we get in this particular case (n = p α , k = up with gcd(u, p) = 1), then we apply the algorithm and we obtain a set of vertices, which are the one with a box around. We get the second graph when α is even and the third if α is odd : Then, the algorithm gives, as in the first case, the size of an optimal k-free set in T j : We just need to add the contribution of all T j 's to get the result. For the case k = up 2 , this time, it is a consequence of the second case.

Proof of Theorem 6
Now, we want to study k-free sets in 1, n , and a good way is to consider the partition Indeed, to be a k-free set is equivalent to not have consecutive elements in such orbits (we abusively call orbit of i the set O k (i) 1, n ). Let see now what being maximal for inclusion means in term of orbits. Actually, we can clearly assume that A is a maximal k-free set (for inclusion) if and only if for each orbits of i ≡ 0 (mod k), exactly one of the two first elements is in A, exactly one of the two last elements is in A, there is not consecutive elements, and for all three consecutives elements, there is at least one which is in A. That leads us to study the following combinatorial problem : A set E ⊂ 1, l satisfies (P) if : We denote by h(l) the minimal size of a set which satisfies (P) in 1, l . Proof. First case : l = 3u. B = {2, 5, · · · , 2 + 3(u − 1)} satisfies (P) and has a size u = l/3. Since we have to take one element among {3i + 1, 3i + 2, 3i + 3} , ∀i ∈ 0, u − 1 , h(l) u. Then, h(3u) = u.
We are now able to prove the Theorem 6.
Proof. If we denote A i := n k i+1 , n k i , we have where d = [log k (n)]. Moreover, with |α(i)| 1. And the numbers of j ≡ 0 (mod k) in A i is with |ǫ(i)| 1. Each element in A i has an orbit of size i + 1, then we deduce from the Lemma 8: To study this sum, we group together by three the terms with same integer part, in order to get a telescopic behaviour. Thus, we get :