def partition_number(number, base):
    "Continually divide number by base until zero."
    div, mod = divmod(number, base)
    yield mod
    while div:
        div, mod = divmod(div, base)
        yield mod
Continually divide number by base until zero.
recipes/Python/578062_Markov/recipe-578062.py