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