Is there an ideal $k$ such that the sequence $\mathrm{frac}(kn)$ is most evenly distributed? I am generating a sequence of numbers in $[0..1)$ where the $n$th number in the sequence is $f(n)=\mathrm{frac}(kn)$ for some constant $k$ and $\mathrm{frac}(x)=x-\mathrm{floor}(x)$.
I want numbers in this sequence to be distributed as evenly as possible, i.e. they should statistically resemble a uniform random distribution.
(The application is generating colours, a colour is $\mathrm{HSV}(f(n),1,1)$ and I want the set of colours to have optimal coverage across the spectrum.)
Is there an "ideal" value of $k$ for this?
By intuition I am taking $k=\phi$, which gives the following sequence:
0
0.618
0.236
0.854
0.472
0.09
0.708
0.326
0.944
0.562
0.18
0.798
0.416
This performs adequately for current purposes, but I am wondering if there is a stronger way to formalise this.
 A: Short answer
Yes! There is an ideal / optimum value for $k$, and you have correctly identified it as $k=\phi \equiv  \frac{1+\sqrt{5}}{2}$, the golden ratio.
Detailed answer
Note that the the math notation for the 'fractional part of a positive number $x$' is usually written as $\{ x \}$, but in the computing world it is usually describes as $x \; (\textrm{mod} \; 1)$. These are both conceptually identical.
The equidistribution theorem, states that the infinite sequence
$$ x_n =  \{ k n \}, \quad n=1,2,3,... $$
will produce an equidistributed sequence for any irrational number $k$. That is, in the limit as $n \rightarrow \infty$, the all finite subintervals of $(0,1)$ will be sampled equally.
However, equidistribution is a necessary but quite a weak criterion for most applications, and does not necessarily imply that for finite $n$ the sequence will fill the interval 'evenly' without large gaps or clusters.
Sequences that satisfy this stronger criterion of 'evenness' are called low discrepancy sequences.
There are many ways to construct low discrepancy sequences, including the van der Corput / Halton sequences, Niederreiter and Sobol sequences to name a few. However, by far the most simple to construct are the Kronecker (sometimes called Weyl) additive recurrence sequences, which are defined exactly as you describe in your question. That is,
$$ x_n = \{ k n \}, \quad n=1,2,3,... $$
It turns out that although all irrational values of $k$ produce an equidistributed sequence, only certain values of $k$ produce low discrepancy sequences. For number theoretic reasons, these special values of $k$ are also correspond to numbers that are badly approximable (by the rationals). Intuitively one can say that the more badly approximable a number is by the rationals, the 'more irrational' it is. This is why the golden ratio, which is the most badly approximable number, is often described as the most irrational number.  The more irrational the value of $k$ is, the better ('more even') the low discrepancy sequence will be. Thus, the golden ratio $k=\phi  = \frac{1+\sqrt{5}}{2} $ produces the optimal low discrepancy sequence.
Two lesser known facts are worth mentioning.
Firstly, any value of $k$ related via the transformation,
$$ k = \frac{a+b\phi}{c+d\phi} \quad \textrm{for integers} \;\;a,b,c,d \;\; \textrm{where} \;  |ad-bc|=1.$$
will also be optimal.
And secondly, $k = 1+\sqrt{2} $ turns out to be the next most badly approximable number -- and therefore the next most optimal value for the construction of a low discrepancy sequence.   Springborn as well as Spalding give number theoretic reasons why this is the second most badly approximable number.
Furthermore, using this same line of reasoning, why $\alpha = \frac{1}{10} (9+\sqrt{221})$ is the third-most badly approximable number, and therefore the 3rd best value for your sequence.
Interestingly the continued fraction for these three values are:
$$ \phi  = 1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{1+...}}} = [1;1,1,1,...]$$
$$ 1+\sqrt{2} = 2+\cfrac{1}{2+\cfrac{1}{2+\cfrac{1}{2+...}}} = [2;2,2,2,2,2] $$
$$ \frac{1}{10}(9+\sqrt{221}) = 2+\cfrac{1}{2+\cfrac{1}{1+\cfrac{1}{1+...}}} = [2;2,1,1,2,2,1,1,2,2,1,1,..] $$
If you are interested in learning more about this, I have written a blog, (which includes many explanatory pictures), 'The unreasonable effectiveness of quasirandom sequences', on how these concepts can naturally extend to higher dimensions and describe how the critical parameter is a natural generalisation of the golden ratio, $\phi$.
Hope this helps!
