def yule_k(num_tokens, freq_spectrum):
    """Calculate Yule’s K (1944).

    Used formula:
        .. math::
            K = 10^4 	imes rac{(\\sum_{X=1}^{X}{{f_X}X^2}) - N}{N^2}

    Parameters:
        num_tokens (int): Absolute number of tokens.
        freq_spectrum (pd.Series): Counted occurring frequencies.
    """
    a = freq_spectrum.index.values / num_tokens
    b = 1 / num_tokens
    return 10 ** 4 * (freq_spectrum.values * a ** 2 - b).sum()
