def to_base_str(n, base):
    """Converts a number n into base `base`."""
    convert_string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    if n < base:
        return convert_string[n]
    else:
        return to_base_str(n // base, base) + convert_string[n % base]