--- from: http://rosettacode.org/wiki/Diversity_prediction_theorem