def common_prefix(n: int) -> str:
    """
    For a given number of subgraphs, return a common prefix that yields around
    16 subgraphs.

    >>> [common_prefix(n) for n in (0, 1, 31, 32, 33, 512+15, 512+16, 512+17)]
    ['', '', '', '', '1', 'f', '01', '11']
    """
    hex_digits = '0123456789abcdef'
    m = len(hex_digits)
    # Double threshold to lower probability that no subgraphs match the prefix
    return hex_digits[n % m] + common_prefix(n // m) if n > 2 * m else ''