def excel_column_name(num):
    """Takes the 0-based index of a column, and returns its Excel-style name.

    >>> excel_column_name(0)
    'A'
    >>> excel_column_name(1)
    'B'
    >>> excel_column_name(23)
    'X'
    >>> excel_column_name(26)
    'AA'
    >>> excel_column_name(57)
    'BF'
    """

    A = ord('A')
    result = []
    remaining = num + 1
    while remaining > 0:
        modulo = (remaining - 1) % 26
        result.append(chr(A + modulo))
        remaining = (remaining - modulo) // 26
    return ''.join(reversed(result))