R Code for Project Euler