import math


def next_halton(index, base):
    """Calculate next halton number """
    result = 0.0
    f = 1.0
    i = index

    while i > 0:
        f = f / base
        result += + f * (i % base)
        i = math.floor(i / base)

    return result