Solutions 1 and 2 in R
Problem 1:
x <- seq(1:1000)
y <- x[ x%%3 == 0 | x%%5 == 0 ] # numbers divisible by 5 or 3
sum( y[ y < 1000 ] ) # sum of divisors < 1000
Solution: 233168
Problem2:
fib = numeric()
fib[1] = 1
fib[2] = 1
i = 2
while (fib[i] < 4000000) {...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.