solution for the first euler problem