Added Octave solution.