Euclid find the greatest commin divisor with Dynamic Programming