import math


def entropy_ideal(length):
    """
    Calculates the ideal Shannon entropy of a string with given length
    :param length:
    :return:
    """
    prob = 1.0 / length

    return -1.0 * length * prob * math.log(prob) / math.log(2.0)