import string


def to_base_n_str(n: int, base: int) -> str:
    """
    Convert an integer to a base N representation, 1 <= N <= 36.
    """
    if base < 1 or base > 36:
        raise RuntimeError("Base must be an integer in the range [1, 36]")
    digitabet = string.digits + string.ascii_uppercase
    if base == 1:
        return "." * n
    if n < base:
        return digitabet[n]
    return to_base_n_str(n // base, base) + digitabet[n % base]