Rework euler 1 into functions