--- from: http://rosettacode.org/wiki/Mian-Chowla_sequence