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