The very first Euler problem. And a relatively simple one.
Find all natural numbers below 1000, that are multiples of 3 or 5. What is the sum?
threes <- seq(3,999,by=3) fives <- seq(5,999,by=5) both <- unique(c(threes,fives)) sum(both)
##  Censored
seq(3, 999, by=3) gives us all numbers below 1000 that are a multiple of 3. Fives contains the numbers that are multiples of 5. Both is the union – unique removes duplicate elements. And sum finally gives the result.
- Make sure you always save your work. Otherwise you will have to reproduce it.