Diophantine conditions in the law of the iterated logarithm for lacunary systems

It is a classical observation that lacunary function systems exhibit many properties which are typical for systems of independent random variables. However, it had already been observed by Erd\H{o}s and Fortet in the 1950s that probability theory's limit theorems may fail for lacunary sums $\sum f(n_k x)$ if the sequence $(n_k)_{k \geq 1}$ has a strong arithmetic ''structure''. The presence of such structure can be assessed in terms of the number of solutions $k,\ell$ of two-term linear Diophantine equations $a n_k - b n_\ell = c$. As the first author proved with Berkes in 2010, saving an (arbitrarily small) unbounded factor for the number of solutions of such equations compared to the trivial upper bound, rules out pathological situations as in the Erd\H{o}s--Fortet example, and guarantees that $\sum f(n_k x)$ satisfies the central limit theorem (CLT) in a form which is in accordance with true independence. In contrast, as shown by the first author, for the law of the iterated logarithm (LIL) the Diophantine condition which suffices to ensure ''truly independent'' behavior requires saving this factor of logarithmic order. In the present paper we show that, rather surprisingly, saving such a logarithmic factor is actually the optimal condition in the LIL case. This result reveals the remarkable fact that the arithmetic condition required of $(n_k)_{k \geq 1}$ to ensure that $\sum f(n_k x)$ shows ''truly random'' behavior is a different one at the level of the CLT than it is at the level of the LIL: the LIL requires a stronger arithmetic condition than the CLT does.


Introduction and main result
The classical Hartman-Wintner law of the iterated logarithm (LIL) was proved by Philip Hartman and Aurel Winter in 1941 [17] and quantifies the typical fluctuation of sums of independent and identically distributed (i.i.d.) random variables on the scale between the central limit theorem (CLT) and the law of large numbers (LLN).More precisely, the LIL states that for a sequence X 1 , X 2 , . . . of i.i.d.random variables of zero mean and finite variance σ 2 ∈ (0, ∞), (1) lim sup 2N log log N = σ almost everywhere (a.e.).
Today it is a well-known fact in analysis and probabilistic number theory that the asymptotic behavior of sums of i.i.d.random variables is echoed in many ways by lacunary trigonometric sums N k=1 cos(2πn k x) under the so-called Hadamard gap condition (2) for a sequence (n k ) k≥1 of natural numbers; this must be seen in consideration of the fact that the random variables X k (x) := cos(2πn k x) on the probability space [0, 1] with Borel σ-algebra endowed with Lebesgue measure λ are identically distributed and uncorrelated (if all n k , k ∈ N, are distinct), but not stochastically independent.Here and in all that follows, the statements remain true if cosine is replaced by sine.
It was shown by Erdős and Gál [8] that under the gap condition (2), (3) lim sup i.e., lacunary trigonometric sums satisfy a Hartman-Wintner LIL under the Hadamard gap condition.Note that the variance of cos(2πn k •) is 1 2 , so (3) is in perfect accordance with (1).Regarding normal fluctuations, Salem and Zygmund proved in [23] and [24] that under the Hadamard gap condition (2), for every t ∈ R, lacunary trigonometric sums satisfy the CLT lim N →∞ λ x ∈ [0, 1] : e −y 2 /2 dy =: Φ(t); again this is in perfect accordance with the CLT for truly independent systems.The analogy between lacunary trigonometric sums and truly random systems goes much further, as the almost sure invariance principles of Berkes [4] and Philipp and Stout [21] show.Concerning large deviation principles, it was shown only recently [3] (and also [9]) that while under the large gap condition n k+1 /n k → ∞ the behavior of lacunary trigonometric sums is in perfect accordance with the truly independent case, under the mere Hadamard gap condition (2) surprising phenomena occur which reflect the particular arithmetic structure of the sequence (n k ) k≥1 .Accordingly, while the CLT and LIL (and other results in a regime close to normal deviations) hold for lacunary trigonometric sums in a universal form, the large deviation behavior of lacunary trigonometric sums is very sensitive to fine arithmetic properties of the sequence (n k ) k≥1 .This is a very interesting effect, which is currently not well understood.On which deviation scale do fine arithmetic phenomena start to play a crucial role for the probabilistic theory of lacunary trigonometric sums?A first step towards a resolution of this question has been taken very recently by the last author together with Strzelecka [22], who studied moderate deviations principles (MDPs) for lacunary trigonometric sums; recall that MDPs cover the deviation range between the CLT and a large deviations principle.
The results discussed so far all concern the case of "pure" trigonometric sums cos(2πn k x) or sin(2πn k x).It turns out that for more general lacunary sums f (n k x) with a 1-periodic function f the heuristics that "lacunary sums mimic the behavior of sums of independent random variables" remains largely intact, but the situation becomes much more delicate.We assume that (n k ) k≥1 satisfies the Hadamard gap condition, and that f : R → R is a function satisfying (4) f (x + 1) = f (x), where Var [0,1] denotes the total variation of f on the interval [0, 1] (note that bounded variation implies integrability).A crucial observation in this setup is the Erdős-Fortet example (see, e.g., [19, p.646]) of the sequence n k = 2 k − 1, k ∈ N, and the periodic function f (x) = cos(2πx) + cos(4πx), for which the classical CLT for f (n k x) fails to hold (and the distribution of the normalized sums instead converges to a "variance mixture" Gaussian distribution), and for which a "non-standard" LIL holds in the form (5) lim sup with a (non-constant) function on the right-hand side.Thus, for f (n k x) the LIL can fail to hold in its truly independent form, and instead as a general result we only have an upper-bound LIL lim sup with a constant c f,q ∈ (0, ∞) depending on f and the growth factor q of (n k ) k≥1 ; see Takahashi [27] for this result, and Philipp [20] for a generalization to the so-called Chung-Smirnov type LIL.The interaction of analytic, arithmetic and probabilistic effects that underpins this theory has led to a wealth of research, leading from famous classical papers such as those of Kac [18] and Gaposhkin [14] to recent work such as that of Berkes, Philipp and Tichy [5], Bobkov and Götze [6], Conze and Le Borgne [7], and in particular Fukuyama [10,11,13,12].
An interesting observation is that in the general framework, the fine probabilistic behavior of lacunary sums f (n k x) is intimately related to the number of solutions of certain linear Diophantine equations, such as the two-variable equation ( 6) We restrict ourselves to non-negative integers c, since we can always switch to this case by exchanging the roles of the parameters k and ℓ and that of a and b, respectively.Note that trivially L(N, a, b, c) ≤ N for any a, b, c with (a, b, c) ̸ = (0, 0, 0) and any N ∈ N, as long as (n k ) k≥1 is a sequence of distinct integers.In [2] it was proved that f (n k x) satisfies the CLT under the assumption that the number of solutions to Diophantine equations of the form ( 6) is asymptotically less than the trivial estimate.More precisely, it was shown in [2, Theorem 1.1] that for any function as in (4) and any lacunary sequence (n k ) k≥1 , and any t ∈ R, provided that the following two conditions are satisfied: (i) The limiting variance is not degenerate, i.e., σ 2 N ≥ CN for some suitable constant C > 0.
(ii) For all positive integers a, b with a ̸ = b, the number of solutions to the Diophantine equation satisfies 1 Let us remark that the condition (i) on the non-degeneracy of the variance already appeared in the work of Gaposhkin [14] and is indeed necessary, as shown by examples leading to telescoping sums such as f (x) = cos(2πx) − cos(4πx) and n k = 2 k , k ≥ 1.As proved in [2], the Diophantine condition L(N, a, b, c) = o(N ) is optimal and cannot be replaced by L(N, a, b, c) ≤ εN for a fixed ε > 0. If additionally to (ii) the sequence (n k ) k≥1 satisfies L(N, a, b, 0) = o(N ) for all a ̸ = b, that is, if the number of solutions of ( 6) with c = 0 on the right-hand side is also small, then (i) is not necessary since in that case one has σ N = ∥f ∥ 2 √ N as N → ∞, and the CLT holds with exactly the same normalizing factor as in the truly independent case (see [2,Theorem 1.2.]).Note that this discussion also explains why the CLT fails to hold for the Erdős-Fortet example: for the sequence n k = 2 k − 1, k ≥ 1, there are too many solutions to the equation namely all N − 1 pairs (k, ℓ) of the form k = ℓ + 1 (cf.Equation (34) below, which explains how the function 2 cos(πx) on the right-hand side of (5) arises).
As explained in the previous paragraph, the results in [2] provide optimal Diophantine conditions guaranteeing the CLT for f (n k x).Thus, the relation between sums of dilated functions and arithmetic information in form of the number of solutions of Diophantine equations is completely understood at the level of the CLT.In contrast, the situation in the case of the LIL is much less satisfactory.It was proved in [1,Theorem 1.3] that for f as in ( 4) and (n k ) k≥1 as in (2), (8) lim sup provided that for all fixed positive integers a, b with a ̸ = b, for some constant ε > 0. Equation ( 8) is in perfect accordance with truly independent behavior.However, unlike in the CLT case, it was unclear whether the Diophantine condition (9) for the LIL case was optimal.There were good reasons to believe that the factor (log N ) 1+ε in the stronger Diophantine condition ( 9) is an artifact coming from the particular proof strategy in [1], which as a key ingredient evokes a classical almost sure invariance principle (ASIP) of Strassen [25].Roughly speaking, Strassen's ASIP for martingale differences requires the almost sure convergence of conditional second moments, which can essentially be established from ( 9) using Chebyshev's inequality.Such an argument seems rather wasteful, and hence some effort was put into trying to relax the Diophantine condition for the LIL down to the one which is known to be sufficient in the CLT case.However, in the present 1 The case a = b is not relevant for our paper, since when a = b and (n k ) k≥1 is lacunary then by Lemma 3 below we always have L(N, a, a, c) = O(1) uniformly in c for c ̸ = 0, and consequently the number of solutions is small enough to be negligible.For a = b and c = 0 we trivially always have L(N, a, a, 0) = N (these solutions are the "diagonal terms" and cannot be avoided).
paper we prove the rather surprising result that the Diophantine condition ( 9) is actually optimal (up to lower-order terms) to ensure the LIL for f (n k x), even when f is restricted to be a trigonometric polynomial.Our main result is the following.Theorem 1.Let ε ∈ (0, 1).Then, for every constant K ∈ (0, ∞), there exist a trigonometric polynomial f with mean zero and a lacunary sequence (n k ) k≥1 such that for all a, b ∈ N with a ̸ = b, we have and such that lim sup Theorem 1 is remarkable as it shows that to guarantee the validity of a probabilistic limit theorem for lacunary sums of dilated functions on the LIL scale, one needs stronger arithmetic assumptions than one does on the CLT scale.We consider this to be a very interesting phenomenon.The necessary savings factor of order roughly log N in the Diophantine condition for the LIL seems to arise essentially as e ( √ 2 log log N ) 2 /2 from the order of the tail of the normal distribution, and thus be directly connected with the fact that the LIL is concerned with deviations exceeding the CLT normalization √ N by an additional factor √ 2 log log N .One cannot help but wonder if a similar direct connection between the necessary arithmetic (Diophantine) condition and the size of the deviation that one is interested in persists throughout other scales; note that such a direct link would have to become meaningless at least for additional factors of order exceeding √ 2 log N , which would correspond to the requirement of saving a factor of more than e ( √ 2 log N ) 2 /2 = N in the Diophantine condition, thus asking for less than one solution in (7), which is absurd. 2If so, then the arithmetic theory underpinning the behavior of lacunary sums at small-scale deviations near √ N would be substantially different from the corresponding theory for deviations at large scales beyond √ 2N log N .One possible explanation for such a dichotomy could be that two-term Diophantine equations can only control the distribution of normalized lacunary sums at small deviation scales, and that at larger scales a different effect sets in which is only expressible in terms of Diophantine equations in more than 2 variables.We leave these questions for future research.

Construction of the sequence & Solutions to Diophantine equations
We now present a completely explicit construction of a Hadamard gap sequence (n k ) k≥1 satisfying the claim of Theorem 1, and we show that it indeed satisfies the bound (10) for the number of solutions of the two-variable linear Diophantine equations in (6).
Step 1.Let ε ∈ (0, 1) and note that this condition can be satisfied by choosing d sufficiently large (with the necessary size of d depending on the parameters ε and K).The number d will later be the degree of 2 Possibly it is no coincidence that martingale methods based on conditional second moments also seem to reach a critical point at deviations of order √ 2 log N , see for example [16].
the trigonometric polynomial f , which we construct in order to prove Theorem 1. Further, let The parameter R will serve as decomposition parameter; we split the set of positive integers N into consecutive blocks ∆ 1 , ∆ 2 , . . .such that #∆ i = R i , i.e., the sizes of the block are rapidly increasing.More precisely, we define From this construction it follows that for each i ∈ N, i.e., the block ∆ i is even much larger than the collection of all previous i − 1 blocks taken together.To put it more illustratively, the partial sum will be dominated by the terms with k ∈ ∆ i , while the terms with k ∈ ∆ 1 ∪ • • • ∪ ∆ i−1 will be essentially negligible, so that the lower bound in Theorem 1 only has to be established for sums Step 2. We shall now split up each block ∆ i , i ∈ N, into disjoint subsets, where the number of subsets depends on the parameter i.More precisely, we decompose i , and such that all sets ∆ (m) i , 1 ≤ m ≤ M (i), have essentially the same cardinality, i.e., (14) #∆ Heuristically, this construction is made in such a way that if we write which reflects our bound (10) on the number of solutions of Diophantine equations; note that the implied constant in the O-term depends on the parameter R.
Illustration of the construction described above.
3 Throughout the paper ⌈x⌉ denotes the smallest integer which is at least as large as x.
Step 3. We shall now construct (n k ) k≥1 .For given i ∈ N, m ∈ {1, . . ., M (i)} and for i , we define ( 16) where the first factor is to be understood as 2 (2 (i 4 ) ) .The heuristic behind this construction is the following.First, the elements of our sequence with indices in different blocks ∆ i 1 and ∆ i 2 are of very different size (because of the dominating prefactor), so that f (n k x) and f i , where there will be many solutions of equations such as namely whenever ℓ = k + 1 (note that the number m on the right-hand side of the Diophantine equation above is the same as in the superscript of the sub-block ∆ (m) i ; different sub-blocks correspond to different Diophantine equations that have "many" solutions).In the Erdős-Fortet example there are no different blocks whatsoever, so that there are many solutions of the particular equation 2n k − n k+1 = 1, which leads to L(N, 2, 1, 1) being as large as ≈ N .We need L(N, a, b, c) to be smaller in order to satisfy (10), and by grouping k, ℓ into approximately (log N ) 1−ε many different blocks, instead of one equation with ≈ N solutions, we obtain (log N ) 1−ε different equations with approximately N (log N ) 1−ε many solutions each, which is in accordance with (15).This explains why the sequence constructed in such a way will satisfy the Diophantine condition (10).It is a different story (and will be shown in Section 4) that the sequence constructed in this very particular way indeed leads to a large value on the right-hand side of the LIL, as claimed by Theorem 1 (and the presence of the factor 2 2 i 4 in the definition of n k will also only become clear later).We will explain the heuristics behind this part of Theorem 1 later on, after defining the trigonometric polynomial f .Note: Throughout the rest of this section, implied constants are allowed to depend on ε and K (and consequently also on d and R), as well as on a and b, but not allowed to depend on anything else.In particular, all implied constants are independent of c, i, m and N .
The next lemma provides estimates on the number of solutions of Diophantine equations arising in our setup.As we shall see shortly, from this we can deduce that the sequence (n k ) k≥1 constructed above indeed satisfies the Diophantine condition (10) of Theorem 1.
Lemma 2. For the sequence (n k ) k≥1 constructed in the paragraph above, we have the following estimates.
(i) For all a, b ∈ N with a ̸ = b, and with a b ̸ = 2 r for all r ∈ Z, we have #{k, ℓ ≥ 1 : uniformly in c ∈ Z ≥0 .(iii) For all a, b ∈ N such that a b = 2 r for some r ∈ Z\{0}, and for all i ∈ N: Before proving Lemma 2, we recall a general result about differences of elements of lacunary sequences.
Lemma 3 ([28, p.203]).Let (m k ) k≥1 be a positive sequence of integers satisfying (2) for some q > 1.Then for all c ∈ Z ≥0 , where the implied constant depends only on the growth factor q.
Proof of Lemma 2. Recalling the definition of L(N, a, b, c) in Equation ( 7), we assume that a, b ∈ N with a ̸ = b, and that c ∈ Z ≥0 .
(i) Assume a b is not of the form 2 r for any r ∈ Z.Note that the number m in the definition in line ( 16) is much smaller than 2 k (for large k).Thus, we have (under slight abuse of the limit notation) that, as k → ∞, (17) n k+1 n k → 2 on those k and k + 1 belonging to the same block ∆ i , and Since a b is not a power of 2 by assumption, this shows that the set (19) # {k, ℓ ≥ 1 : is finite.To see this, we assume there are infinitely many pairs k, ℓ ∈ N such that an k −bn ℓ = 0, i.e., n k n ℓ = a b .Recall that a and b are assumed to be fixed.Thus, by (18) there can only be finitely many solutions of this equation for which k and ℓ belong to different blocks.Assume that a b > 1, which means that n k n ℓ = a b is only possible if k > ℓ (the case a b < 1 can be treated similarly; the case a b = 1 is impossible since a b is not an integer power of 2 by assumption).Since a b is not an integer power of 2 by assumption, there exists a δ > 0 such that a b ̸ ∈ j≥1 (2 − δ) j , (2 + δ) j .However, on the other hand, by (17) for all sufficiently large k and ℓ with k > ℓ which belong to the same block, we have Thus, n k n ℓ = a b is possible for only finitely many pairs (k, ℓ) which belong to the same block.As noted above, there are also only finitely many solutions (k, ℓ) which belong to different blocks.Overall, the cardinality of the set in (19) is O(1).
We now form the set-theoretic union and write the elements of A as a sequence (m k ) k≥1 (sorted in increasing order).Because of ( 17) and ( 18), we have lim inf k→∞ m k+1 m k > 1 so that the sequence (m k ) k≥1 is a lacunary sequence with some suitable growth factor (which depends on a and b, but these are assumed to be fixed).Thus, by Lemma 3, we have where the implied constant in the O-term is independent of c; note that the first estimate is trivial since on the right-hand side we have twice as many equations (and thus potential solutions).Summarizing our results, in case (i) of the Lemma we have (20) # {k, ℓ ≥ 1 : uniformly in c ≥ 0.
(ii) Now assume a b = 2 r for some r ∈ Z\{0}.We first show that there are not many solutions where k and ℓ come from different blocks.Assume that k ∈ ∆ i 1 and ℓ ∈ ∆ i 2 such that i 1 < i 2 .Then, whenever i 2 is so large that 2 r+1 ≤ 2 2 i 2 (which excludes only finitely many values of i 1 and i 2 ), using the trivial estimate Consequently, an k − bn ℓ = c is not possible for any non-negative c when i 2 is sufficiently large.Assume again that k ∈ ∆ i 1 and ℓ ∈ ∆ i 2 , but now such that i 1 > i 2 .Then similar to the previous calculation, assuming that i 1 is sufficiently large so that 2 −r+1 ≤ 2 2 i 1 , and now using that holds for all i 1 ∈ N, we have (recall that a b = 2 r and trivially Thus, whenever i 1 is sufficiently large, then Consequently, for sufficiently large i 1 (assuming that "sufficiently large" includes the fact that i 1 ≥ 10), the equality an k − bn ℓ = c requires that We claim that, uniformly in c ∈ Z ≥0 , there are only finitely many k ∈ N such that (21) holds; more precisely, if k is sufficiently large, then (21) uniquely determines k.Indeed, by ( 17) and ( 18) we have n k n k−1 ≥ 3 2 for all sufficiently large k.Thus whenever we have (21), then as well as with the possible exception of finitely many indices.Thus, overall we have shown that in the case a b = 2 r for some r ∈ Z\{0}, we have with an implied constant that is independent of c ≥ 0. This settles case (ii) of the lemma.
(iii) Now we are in the situation where k, ℓ are contained in the same block ∆ i for some i ∈ N. We establish a few general estimates which we shall use in the proof of both (iii) a) and (iii) b).
Recall that we are in the case where there exists an r ∈ Z\{0} with a b = 2 r and let k, ℓ ∈ ∆ i with k + r > ℓ.Then, for suitable m 1 , m 2 ∈ {1, . . ., M (i)}, we have Thus, an k − bn ℓ = c can only hold when and for given b, c, r, m 1 , m 2 (whence the right-hand side of this equation is fixed) there is at most one pair (k, ℓ) with k + r > ℓ for which this can hold (this is essentially the uniqueness of the dyadic representation of integers).There are O(M (i) 2 ) = O(i 2 ) many possible values for m 1 , m 2 , so the total number of solutions (k, ℓ) of an k − bn ℓ = c with k + r > ℓ and k, ℓ ∈ ∆ i is at most O(i 2 ), uniformly in c ≥ 0. The same argument can be applied to the case k + r < ℓ.Thus, we have established (23) sup The number of pairs of indices k and ℓ with k + r = ℓ, which are contained in different sub-blocks k ∈ ∆ Thus, by (23) we have In the following, we only consider the case where r > 0 (the case r < 0 can be treated in an analogous way).We need to count the number of k and ℓ such that k + r = ℓ and k, ℓ ∈ ∆ (m ′ ) i for some m ′ ∈ {1, . . ., M (i)}, where we have Now we prove (iii) a), where we assumed that c is of the special form c = 2 2 i 4 bm(2 r − 1) for some m ∈ {1, . . ., M (i)}.By (25), the equation an k − bn ℓ = c is satisfied if and only if m = m ′ and thus Combining ( 14), ( 24) and ( 26), we get in case (iii) a) as desired.
Now assume that we are in case (iii) b), i.e., c is not of the form 2 2 i 4 bm(2 r − 1) for any m ∈ {1, . . ., M (i)}.Then (25) yields and from (24), we obtain We can now prove that our gap sequence (n k ) k≥1 satisfies the desired Diophantine condition.
Corollary 4. The sequence (n k ) k≥1 constructed in this section satisfies the Diophantine condition (10) of Theorem 1.
Proof.Let a, b ∈ N be fixed.Let N ∈ N be given, and let I ∈ N be such that N ∈ ∆ I .We observe the following (note that i+1 i 1−ε ≤ 2 for all i ∈ N) Rearranging the terms and using the fact that there exists a constant c > 0 (depending on R) such that c log N ≤ I and R I ≤ RN yields Combining all the worst-case estimates from Lemma 2, the previous calculation shows that #{k, ℓ ≤ N : uniformly in c ∈ Z ≥0 , as claimed.□

Further ingredients -Gaposhkin's Berry-Esseen result
We will need a Berry-Esseen type quantitative central limit theorem for the particular lacunary trigonometric sum N k=1 cos(2π2 k x).As in the introduction, λ denotes Lebesgue measure and Φ denotes the standard normal distribution function.

The law of the iterated logarithm
Let ε ∈ (0, 1) and K ∈ (0, ∞).We now define our trigonometric polynomial where d satisfies (11), i.e., d 2 .We will prove that for this trigonometric polynomial f , and for the gap sequence (n k ) k≥1 we constructed in Section 2, the conclusion of Theorem 1 is indeed satisfied.
Clearly, since our cosine functions are uncorrelated, (27) ∥f Applying the Erdős-Gál law of the iterated logarithm (see Equation ( 3)) together with the triangle inequality gives (28) lim sup Recall that #∆ i = R i .We will show that (29) lim sup Assuming this to be true, then with the notation and upon noting that {1, . . ., N (i By ( 11) and ( 27), we have d Thus, it remains to establish (29).We note in passing that this chain of calculations actually gives a quantitative form of Theorem 1, where the dependence between the factor K, the size of ε from the savings in the Diophantine condition, and the degree d of the trigonometric polynomial are brought into relation.The conclusion of Theorem 1 is non-trivial when the right-hand side exceeds ∥f ∥ 2 .One can check that for K = 1, the inequality (11) holds for d = 21ε −1 , so that for given ε from the Diophantine condition, we can construct a counterexample to the LIL in its "truly independent" form by considering a trigonometric polynomial of degree ⌈21ε −1 ⌉.As ε in the Diophantine condition approaches 0, we need to increase the degree of the trigonometric polynomial to get a result which doesn't match with the "truly independent" form of the LIL.The main result of this paper is that the Diophantine condition ( 9) is essentially optimal when trigonometric polynomials of arbitrary degree are considered; however, we do emphatically not claim that this condition is also optimal in the case of trigonometric polynomials whose degree is bounded.For degree 1 (the Erdős-Gál case), no Diophantine condition at all is necessary.For trigonometric polynomials of degree 2, we believe that a condition of order roughly should be optimal, and for degree at most d, a condition of the should be optimal, with some suitable constants c(d) for which c(d) ↗ 1 as d → ∞.The relation between d and ε was not in our main focus when writing this paper, but this seems to be an interesting topic for further research.
It remains to prove (29).For i ∈ N, let F i be the sigma-field generated by the collection of intervals a − 1 We set as well as which, as we shall see in a moment, is a good approximation of the random variable Y i ; in probabilistic parlance, the system (F i ) i≥1 forms a filtration of the unit interval.Using that and setting for a ∈ 1, . . ., 2 2 (i+1) 4 =: S i , where i ∈ N, we see that by using the standard estimate |f which goes rapidly to zero as i → ∞ (recall that R and d are fixed).Thus, we have lim sup (which is just another way of writing ( 29)) if and only if and our aim thus becomes to establish (30).For this purpose, we define the sets where the terms which are subtracted on the right-hand side will allow us to incorporate errors which will appear later on in the computations.By construction, A i is F i -measurable for all i ≥ 1.We claim that A i is independent of F i−1 (and hence also independent of This follows from the fact that all numbers n k with k ∈ ∆ i are integer multiples of 2 2 i 4 and hence the functions Y i and Z i are periodic with period-length 1 2 2 i 4 .From that we infer, again writing ) has the same value for all a ∈ S i−1 .Thus, for all x ∈ [0, 1], we obtain which proves our claim.Hence, the sets A 1 , A 2 , A 3 , . . .are stochastically independent -this was the purpose of the factor 2 2 i 4 in the definition of (n k ) k≥1 in ( 16) for all k from the same block ∆ i , and for switching from Y i to the discretized approximations Z i . 4  It remains to establish that (31) Then, by an application of the second Borel-Cantelli lemma (using the independence of the sets A 1 , A 2 , . . .), we can conclude that almost all x ∈ [0, 1] are contained in infinitely many 4 Our aim is to prove that for all i the lacunary sum k∈∆ i f (n k x) is large for a sufficiently large set of values of x, which yields the desired LIL by an application of the divergence Borel-Cantelli lemma.Without the factor 2 2 i 4 in the definition of n k for all k from the same block ∆i we would lack the necessary stochastic independence of these set, which is a necessary prerequisite for an application of the divergence Borel-Cantelli lemma.More specifically, in what follows we will decompose k∈∆ i f (n k x) into the product of a "local variance function", multiplied with a pure trigonometric sum (whose distribution is close to Gaussian), and we have to make sure that the local variance function is not large at the same locations of x, for different values of i.
As observed before, we have ∥Y i − Z i ∥ ∞ ≤ 1 for all sufficiently large i ∈ N. Thus, by the triangle inequality (32) for all sufficiently large i ∈ N. As noted, Y i is periodic with period 2 2 i 4 .We now define a new sequence (ν k ) k≥1 via or, equivalently, via Now we will relate the particular choice of our function f with our particular construction of the sequence (n k ) k≥1 , somewhat in the spirit of the Erdős-Fortet example.The key point of the Erdős-Fortet example is that in the sum cos(2π(2 k − 1)x) + cos(4π(2 k − 1)x) , the term cos(4π(2 k − 1)x) = cos(2π(2 k+1 − 2)x) (from frequency 4π and index k) and the term cos(2π(2 k+1 − 1)x) (from frequency 2π and index k + 1) can be combined, so that by the standard trigonometric identity cos(α) + cos(β) = 2 cos α+β i.e., the generalized lacunary sum essentially decomposes into the product of the fixed function 2 cos(πx) and a purely trigonometric lacunary sum (this explains why the factor 2 cos(πx) appears on the right-hand side of ( 5)).Our sum k∈∆ i f (ν k x) will split in a somewhat similar way into a (slowly fluctuating) function g i (x), multiplied with a purely trigonometric lacunary sum (to which we can apply Gaposhkin's quantitative CLT of Lemma 5).However, while in Erdős-Fortet's construction the contribution of only two subsequent summation indices can be combined (leading to a factor 2 cos(πx) which is bounded by 2), in our construction the contribution of d subsequent summation indices can be combined, leading to a function g i (x) which becomes as large as d for some values of x.We will continue to comment on the heuristics after some further steps of calculations.
For i ≥ 1 and m ∈ {1, . . ., M (i)}, we have The sequence (n k ) k≥1 (and so (ν k ) k≥1 ) and the trigonometric polynomial f were constructed in such a way that in the representation (35) there are many terms that can be combined.More precisely, when understanding k + j = ℓ as a new summation index in (35), then there are d many different pairs (k, j) for which k + j adds up to ℓ.Thus, the sum in (35) can be rewritten as where E i,m (x) is an error term consisting of sums of cosines which comes from a) the d smallest indices ℓ ∈ ∆ i . 5Hence, E i,m is a sum of at most d 2 many cosine functions, and thus as well as (recall Let w ∈ N.Then, applying the trigonometric identity cos(x + y) = cos x cos y − sin x sin y, we have Applying this to the sum in (36), together with (35) and the trigonometric identity cos(2πy) = 1 − 2(sin(πy)) 2 , y ∈ R, after summing over m = 1, . . ., M (i), we arrive at We comment one last time on the heuristics behind our construction of the function f and the sequence (n k ) k≥1 .They were carefully adapted to each other so that (after removing the extra periodicity by changing from n k to ν k ), we can essentially write where g i (x) is a function which becomes as large as d when x is small (we ignore here the fact that in the equations above, one lacunary sum is a sine sum, not a cosine sum).Heuristically (ignoring that g i (x) also depends on m), we essentially have g i (x), where g (1) i and g (2) i are the slowly fluctuating functions in the double sums in lines (38) and (39), respectively.We can ensure that g i and g i are small when x is smaller than 1/M (i) ≈ i −1+ε by some factor.The sum R −i/2 k∈∆ i cos(2π2 k x) is a classical normalized lacunary sum and behaves like a Gaussian N (0, 1/2) random variable (see, e.g., [18,Theorem 1]).Thus, for x near 0, the sum R −i/2 k∈∆ i f (ν k x) essentially behaves like R −i/2 d k∈∆ i cos(2π2 k x) and thus like a N (0, d 2 /2) random variable (locally for x near 0 we have gained a factor d for the variance in comparison with ∥f ∥ 2 2 , this is the key point!), and we can factorize The size of the set of values of x which are close enough to 0 is around i −1+ε , see above, while the probability of a N (0, d 2 /2) r.v.exceeding something around d . Overall this gives a probability of i −1+ε/2 that k∈∆ i f (ν k x) is "large", which allows an application of the divergence Borel-Cantelli lemma.Now we make this heuristic precise.Let i ∈ N and h i ∈ N such that for sufficiently large i.If i is sufficiently large, then for all k ∈ ∆ i we have k ≥ R i−1 ≥ i ≥ h i , so that by periodicity, for all t > 0, we have (recall that #∆ Applying Gaposhkin's Berry-Esseen type estimate (see Lemma 5) with all weights being equal, we obtain using 1 − Φ(y) ≥ 1/(4ye y 2 /2 ) for y ≥ 4 (see, e.g., [26,Proposition 3]), that for sufficiently large i ∈ N.
We need to show that the terms in (38), (39) and (40) do not make a relevant contribution when x ∈ [0, 2 −h i ].Recall that by construction the smallest index k in ∆ i is of size at least R i−1 , and that for sufficiently large i ∈ N, we have R i−1 ≥ h i .We will work on short intervals of the form (sin(π2 j mx)) 2 − s a,m,i ≤ Furthermore, since we assumed that a 2 R i−1 ∈ [0, 2 −h i ], we have for sufficiently large i ∈ N.
Thus, by periodicity, using Lemma 5 with the weights λ k as specified above, and using (44), we have uniformly in a for sufficiently large i ∈ N (the last estimate is very coarse, but the point is that our estimate leads to a convergent series), where c > 0 is an absolute constant.Note that (42) implies for sufficiently large i ∈ N, as a bound for the contribution of the term in line (38).
An analogous argument for the contribution of the term in line (39) yields where the relevant point for the argument is that the function d−1 j=0 sin(2π2 j mx) is also very small in the interval [0, 2 −h i ] (and where we use a variant of Gaposhkin's Lemma 5 for sine instead of cosine).
Here a, b ∈ N and c ∈ Z ≥0 are fixed, and one has to consider the number of solutions (k, ℓ) of the equation with the size of the indices k, ℓ being bounded above by some threshold value.If N ∈ N, we shall write(7) L(N, a, b, c) := # {1 ≤ k, ℓ ≤ N : an k − bn ℓ = c} .

i
, for which there do not exist d many pairs (k, j) with k ∈ ∆ (m) i and j ∈ {0, . . ., d − 1} such that k + j = ℓ, and b) from the d largest indices k in ∆ (m) i for which k + j exceeds all elements ℓ ∈ ∆ (m)

sin π2 j m2 −h i 2 ≤ d− 1 j=0π2 j m2 −h i 2 ≤
in a and m.For i ∈ N, we set S a,i := Note that, using the estimates S a,i ≥ #∆ ⌈i 1−ε ⌉ − 1 for all m ∈ {1, . . ., M (i)} by(14) k x) ≤ R i 2 d+1 πm 2 R i−1 ≤ 1for sufficiently large i ∈ N.After summing over all a such thata 2 R i−1 , a+1 2 R i−1 ⊂ [0, 2 −h i ],using the previous estimate and the triangle inequality, we finally arrive at λ k x) > 2R i log log R i + 1 are "essentially independent".Such pairs k and ℓ also do not play a relevant role for counting the number of solutions of the Diophantine equations, see Lemma 2 (ii) below.Similarly, pairs k and ℓ which are contained in the same block ∆ i , but in different sub-blocks ∆ significant role for counting the number of solutions of the Diophantine equations either, see Lemma 2 (iii).What will contribute significantly are only pairs k, ℓ from the same sub-block ∆