--- from: http://rosettacode.org/wiki/Rare_numbers note: Mathematics