Bruteforcing - index by modulo.

t <- 1:999
answer <- sum(t[t %% 3 == 0 | t %% 5 == 0])