# A Uniformly Distributed Sequence

# A Uniformly Distributed Sequence

### The theorem is true for every increasing sequence of integers, but the exceptional set of xs may be different for each integer sequence.

Join the DZone community and get the full member experience.

Join For FreeHortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

If you take the fractional parts of a set of numbers **{ cos nx : integer n > 0}**, the result is uniformly distributed for almost all

**. That is, in the limit, the number of times the sequence visits a subinterval of**

*x***[0, 1]**is proportional to the length of the interval. (Clearly it's not true for all

**: take**

*x***, for instance. Or any rational number times**

*x*= 0**π**.)

The proof requires some delicate work with Fourier analysis that I'll not repeat here. If you're interested in the proof, see Theorem 4.4 of Uniform Distribution of Sequences.

This is a surprising result. Why should such a strange sequence be uniformly distributed? Let's look at a histogram to see whether the theorem is plausible.

OK. Looks plausible.

But there's a generalization that's even more surprising. Let ** a** be any increasing sequence of integers. Then the fractional parts of

*a***cos**

**are uniformly distributed for almost all**

*ax***.**

*x*Any increasing sequence of integers? Like the prime numbers, for example? Apparently so. The result produces a very similar histogram.

But this can't hold for just any sequence. Surely, you could pick an integer sequence to thwart the theorem. Pick an ** x**, then let

**be the subset of the integers for which**

*a***. Then**

*n*cos*nx*< 0.5**isn't uniformly distributed because it never visits the right half the unit interval!**

*a*cos*ax*Where's the contradiction? The theorem doesn't start by saying "For almost all ** x**..." It starts by saying "For any increasing sequence

**..." — that is, you don't get to pick**

*a***first. You pick the sequence first, then you get a statement that is true for almost all**

*x***. The theorem is true for every increasing sequence of integers, but the exceptional set of**

*x***s may be different for each integer sequence.**

*x*Hortonworks Community Connection (HCC) is an online collaboration destination for developers, DevOps, customers and partners to get answers to questions, collaborate on technical articles and share code examples from GitHub. Join the discussion.

Published at DZone with permission of John Cook , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

## {{ parent.title || parent.header.title}}

## {{ parent.tldr }}

## {{ parent.linkDescription }}

{{ parent.urlSource.name }}