An algorithm to calculate the index of coincidence.