--- from: http://rosettacode.org/wiki/Jensen's_Device note: Classic CS problems and programs