You are viewing a single comment's thread from:
RE: Brainsteem Compute #1 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]
I've coded mine in the programming language R. (Can't upload images in post)
Here is my code (and output):
> ## Rycharde's Challenge:
>
> # Find the sum of all the multiples of 5 or 7 below 2000:
>
> # Limiting number:
>
> limit_number <- 2000
>
> # Empty Vector:
> candidates <- c()
>
> for (i in 1:(limit_number - 1)){
+ if (i %% 5 == 0 | i %% 7 == 0){
+ candidates <- c(candidates, i) # Append.
+ }
+ }
>
> sum(candidates) # Print Total; 626430
[1] 626430
Many thanks!