def digits_required(length):
    """
    Returns the number of digits that would be needed to represent 'length'
    number of elements.
    """
    digits = 0
    while 10 ** digits <= length:
        digits += 1
    return digits
