--- from: http://rosettacode.org/wiki/Matrix_chain_multiplication note: Discrete math