solving euler problems in R