from typing import Sequence
import string


def int_to_base(
    n: int,
    base: int,
    numerals: Sequence[str] = '0123456789' + string.ascii_lowercase,
) -> str:
    """Forms a string representation of a non-negative integer in a given base.

    Args:
        n: A non-negative integer value.
        base: The base in which ``n`` will be represented. Must be a positive
            integer from 2 to ``len(numerals)``.
        numerals: A sequence of string tokens that will be used to represent
            the digits from 0 to ``base - 1`` in order.

    Returns:
        A string representation of ``n`` in the given base, where each digit is
        given by the corresponding value of ``numerals``.

    References:
        Adapted from http://stackoverflow.com/questions/2267362/.
    """

    # base case: 0 is represented as numerals[0] in any base
    if n == 0:
        return numerals[0]

    # compute the low-order digit and recurse to compute higher order digits
    div, mod = divmod(n, base)
    return int_to_base(div, base, numerals).lstrip(numerals[0]) + numerals[mod]