Halton sequence

To generate the sequence for 2, we start by dividing the interval (0,1) in half, then in fourths, eighths, etc., which generates Equivalently, the nth number of this sequence is the number n written in binary representation, inverted, and written after the decimal point.

As an example, to find the sixth element of the above sequence, we'd write 6 = 1*22 + 1*21 + 0*20 = 1102, which can be inverted and placed after the decimal point to give 0.0112 = 0*2-1 + 1*2-2 + 1*2-3 = 3⁄8.

To avoid this, it is common to drop the first 20 entries, or some other predetermined quantity depending on the primes chosen.

Using, e.g., only each 409th point (also other prime numbers not used in the Halton core sequence are possible), can achieve significant improvements.

[1] In pseudocode: An alternative implementation that produces subsequent numbers of a Halton sequence for base b is given in the following generator function (in Python).

Illustration of the first 8 points of the 2,3 Halton sequence