Solving problems from Project Euler in R